Class: Factor::Log::BasicLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/logger/basic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Logger

#time

Instance Attribute Details

#destination_streamObject

Returns the value of attribute destination_stream.



7
8
9
# File 'lib/logger/basic.rb', line 7

def destination_stream
  @destination_stream
end

Instance Method Details

#error(options = {}) ⇒ Object



26
27
28
# File 'lib/logger/basic.rb', line 26

def error(options = {})
  log :error, options
end

#info(options = {}) ⇒ Object



18
19
20
# File 'lib/logger/basic.rb', line 18

def info(options = {})
  log :info, options
end

#log(section, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/logger/basic.rb', line 9

def log(section, options={})
  options       = { message: options } if options.is_a?(String)
  tag           = tag(options)
  message       = options['message'] || options[:message]
  section_text  = format_section(section)
  write "[ #{section_text} ] [#{time}]#{tag} #{message}" if message
  exception options[:exception] if options[:exception]
end

#success(options = {}) ⇒ Object



30
31
32
# File 'lib/logger/basic.rb', line 30

def success(options = {})
  log :success, options
end

#warn(options = {}) ⇒ Object



22
23
24
# File 'lib/logger/basic.rb', line 22

def warn(options = {})
  log :warn, options
end