Class: HackyHAL::Log

Inherits:
Logger
  • Object
show all
Includes:
Singleton
Defined in:
lib/hacky_hal/log.rb

Defined Under Namespace

Classes: Formatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLog

Returns a new instance of Log.



17
18
19
20
21
# File 'lib/hacky_hal/log.rb', line 17

def initialize
  super($stdout)
  self.enabled = true
  self.formatter = Formatter.new
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/hacky_hal/log.rb', line 8

def enabled
  @enabled
end

Instance Method Details

#add(severity, message = nil, progname = nil, &block) ⇒ Object



24
25
26
# File 'lib/hacky_hal/log.rb', line 24

def add(severity, message = nil, progname = nil, &block)
  add_without_enabled_switch(severity, message, progname, &block) if enabled
end

#add_without_enabled_switchObject



23
# File 'lib/hacky_hal/log.rb', line 23

alias_method :add_without_enabled_switch, :add

#write(string) ⇒ Object

for compatibility with Rack logger



29
30
31
# File 'lib/hacky_hal/log.rb', line 29

def write(string)
  self << string
end