Class: DohLogger::StandardInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/doh/logger/standard_interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#literalObject

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_acceptorsObject



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_acceptorsObject



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

#notify(msg, location = '') ⇒ Object



24
25
26
# File 'lib/doh/logger/standard_interface.rb', line 24

def notify(msg, location = '')
  add(NOTIFY, msg, location)
end

#warn(msg, location = '') ⇒ Object



28
29
30
# File 'lib/doh/logger/standard_interface.rb', line 28

def warn(msg, location = '')
  add(WARN, msg, location)
end