Module: Logging::Appenders
- Extended by:
- Appenders
- Included in:
- Appenders
- Defined in:
- lib/logging/appenders/email.rb,
lib/logging/appenders.rb,
lib/logging/appenders/io.rb,
lib/logging/appenders/file.rb,
lib/logging/appenders/growl.rb,
lib/logging/appenders/syslog.rb,
lib/logging/appenders/console.rb,
lib/logging/appenders/buffering.rb,
lib/logging/appenders/string_io.rb,
lib/logging/appenders/rolling_file.rb
Overview
a replacement EmailOutputter. This is essentially the default EmailOutputter from Log4r but with the following changes:
1) if there is data to send in an email, then do not send anything
2) connect to the smtp server at the last minute, do not connect at startup and then send later on.
3) Fix the To: field so that it looks alright.
Defined Under Namespace
Modules: Buffering Classes: Email, File, Growl, IO, RollingFile, Stderr, Stdout, StringIo, Syslog
Instance Method Summary collapse
-
#[](name) ⇒ Object
call-seq: Appenders.
-
#[]=(name, value) ⇒ Object
call-seq: Appenders = appender.
-
#each(&block) ⇒ Object
call-seq: each {|appender| block}.
-
#email(*args) ⇒ Object
Accessor / Factory for the Email appender.
-
#file(*args) ⇒ Object
Accessor / Factory for the File appender.
-
#growl(*args) ⇒ Object
Accessor / Factory for the Growl appender.
-
#io(*args) ⇒ Object
Accessor / Factory for the IO appender.
-
#remove(name) ⇒ Object
call-seq: Appenders.remove( name ).
-
#reset ⇒ Object
:stopdoc:.
-
#rolling_file(*args) ⇒ Object
Accessor / Factory for the RollingFile appender.
-
#stderr(*args) ⇒ Object
Accessor / Factory for the Stderr appender.
-
#stdout(*args) ⇒ Object
Accessor / Factory for the Stdout appender.
-
#string_io(*args) ⇒ Object
Accessor / Factory for the StringIo appender.
-
#syslog(*args) ⇒ Object
Accessor / Factory for the Syslog appender.
Instance Method Details
#[](name) ⇒ Object
call-seq:
Appenders[name]
Returns the appender instance stored in the appender hash under the key name, or nil
if no appender has been created using that name.
80 |
# File 'lib/logging/appenders.rb', line 80 def []( name ) @appenders[name] end |
#[]=(name, value) ⇒ Object
call-seq:
Appenders[name] = appender
Stores the given appender instance in the appender hash under the key name.
88 |
# File 'lib/logging/appenders.rb', line 88 def []=( name, value ) @appenders[name] = value end |
#each(&block) ⇒ Object
call-seq:
each {|appender| block}
Yield each appender to the block.
103 104 105 106 |
# File 'lib/logging/appenders.rb', line 103 def each( &block ) @appenders.values.each(&block) return nil end |
#email(*args) ⇒ Object
Accessor / Factory for the Email appender.
7 8 9 10 |
# File 'lib/logging/appenders.rb', line 7 def email( *args ) return ::Logging::Appenders::Email if args.empty? ::Logging::Appenders::Email.new(*args) end |
#file(*args) ⇒ Object
Accessor / Factory for the File appender.
14 15 16 17 |
# File 'lib/logging/appenders.rb', line 14 def file( *args ) return ::Logging::Appenders::File if args.empty? ::Logging::Appenders::File.new(*args) end |
#growl(*args) ⇒ Object
Accessor / Factory for the Growl appender.
21 22 23 24 |
# File 'lib/logging/appenders.rb', line 21 def growl( *args ) return ::Logging::Appenders::Growl if args.empty? ::Logging::Appenders::Growl.new(*args) end |
#io(*args) ⇒ Object
Accessor / Factory for the IO appender.
28 29 30 31 |
# File 'lib/logging/appenders.rb', line 28 def io( *args ) return ::Logging::Appenders::IO if args.empty? ::Logging::Appenders::IO.new(*args) end |
#remove(name) ⇒ Object
call-seq:
Appenders.remove( name )
Removes the appender instance stored in the appender hash under the key name.
96 |
# File 'lib/logging/appenders.rb', line 96 def remove( name ) @appenders.delete(name) end |
#reset ⇒ Object
:stopdoc:
109 110 111 112 113 114 115 116 |
# File 'lib/logging/appenders.rb', line 109 def reset @appenders.values.each {|appender| next if appender.nil? appender.close } @appenders.clear return nil end |
#rolling_file(*args) ⇒ Object
Accessor / Factory for the RollingFile appender.
35 36 37 38 |
# File 'lib/logging/appenders.rb', line 35 def rolling_file( *args ) return ::Logging::Appenders::RollingFile if args.empty? ::Logging::Appenders::RollingFile.new(*args) end |
#stderr(*args) ⇒ Object
Accessor / Factory for the Stderr appender.
42 43 44 45 46 47 |
# File 'lib/logging/appenders.rb', line 42 def stderr( *args ) if args.empty? return self['stderr'] || ::Logging::Appenders::Stderr.new end ::Logging::Appenders::Stderr.new(*args) end |
#stdout(*args) ⇒ Object
Accessor / Factory for the Stdout appender.
51 52 53 54 55 56 |
# File 'lib/logging/appenders.rb', line 51 def stdout( *args ) if args.empty? return self['stdout'] || ::Logging::Appenders::Stdout.new end ::Logging::Appenders::Stdout.new(*args) end |