Class: DohLogger::StandardInterface
- Defined in:
- lib/doh/logger/standard_interface.rb
Instance Attribute Summary collapse
-
#literal ⇒ Object
Returns the value of attribute literal.
Instance Method Summary collapse
- #add_acceptor(severity_threshold, acceptor, exact_severity_only = nil, locations_to_exclude = nil, include_only_locations = nil) ⇒ Object
- #debug(msg, location = '') ⇒ Object
- #disable_acceptors ⇒ Object
- #enable_acceptors ⇒ Object
-
#error(msg, excpt = nil, location = '') ⇒ Object
temporarily have this ordering of arguments, until all old style calls are switched.
-
#fatal(msg, excpt = nil, location = '') ⇒ Object
temporarily have this ordering of arguments, until all old style calls are switched.
- #info(msg, location = '') ⇒ Object
-
#initialize(scheduler) ⇒ StandardInterface
constructor
A new instance of StandardInterface.
- #notify(msg, location = '') ⇒ Object
- #warn(msg, location = '') ⇒ Object
Constructor Details
#initialize(scheduler) ⇒ StandardInterface
Returns a new instance of StandardInterface.
8 9 10 11 12 |
# File 'lib/doh/logger/standard_interface.rb', line 8 def initialize(scheduler) @scheduler = scheduler @acceptors = [] @disabled_acceptors = [] end |
Instance Attribute Details
#literal ⇒ Object
Returns the value of attribute literal.
7 8 9 |
# File 'lib/doh/logger/standard_interface.rb', line 7 def literal @literal end |
Instance Method Details
#add_acceptor(severity_threshold, acceptor, exact_severity_only = nil, locations_to_exclude = nil, include_only_locations = nil) ⇒ Object
40 41 42 |
# File 'lib/doh/logger/standard_interface.rb', line 40 def add_acceptor(severity_threshold, acceptor, exact_severity_only = nil, locations_to_exclude = nil, include_only_locations = nil) @acceptors.push([severity_threshold, acceptor, exact_severity_only, locations_to_exclude, include_only_locations]) end |
#debug(msg, location = '') ⇒ Object
36 37 38 |
# File 'lib/doh/logger/standard_interface.rb', line 36 def debug(msg, location = '') add(DEBUG, msg, location) end |
#disable_acceptors ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/doh/logger/standard_interface.rb', line 44 def disable_acceptors() to_disable = @acceptors.inject([]) do |sum, acceptor| sum.push(acceptor) if yield(acceptor) sum end @disabled_acceptors.concat(to_disable) @acceptors.reject! {|elem| to_disable.include?(elem)} end |
#enable_acceptors ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/doh/logger/standard_interface.rb', line 53 def enable_acceptors() to_enable = @disabled_acceptors.inject([]) do |sum, acceptor| sum.push(acceptor) if yield(acceptor) sum end @acceptors.concat(to_enable) @disabled_acceptors.reject! {|elem| to_enable.include?(elem)} end |
#error(msg, excpt = nil, location = '') ⇒ Object
temporarily have this ordering of arguments, until all old style calls are switched
20 21 22 |
# File 'lib/doh/logger/standard_interface.rb', line 20 def error(msg, excpt = nil, location = '') add(ERROR, msg, location, excpt) end |
#fatal(msg, excpt = nil, location = '') ⇒ Object
temporarily have this ordering of arguments, until all old style calls are switched
15 16 17 |
# File 'lib/doh/logger/standard_interface.rb', line 15 def fatal(msg, excpt = nil, location = '') add(FATAL, msg, location, excpt) end |
#info(msg, location = '') ⇒ Object
32 33 34 |
# File 'lib/doh/logger/standard_interface.rb', line 32 def info(msg, location = '') add(INFO, msg, location) end |