Class: Logification::Logger

Inherits:
Object
  • Object
show all
Includes:
Helpers::LoggingMethods, Helpers::Wrapper
Defined in:
lib/logification/logger.rb

Constant Summary

Constants included from Helpers::LoggingMethods

Helpers::LoggingMethods::TAB

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Wrapper

#wrap

Methods included from Helpers::LoggingMethods

#debug, #error, #fatal, #info, #is_nested?, #warn

Constructor Details

#initialize(options = {}) ⇒ Logger

Returns a new instance of Logger.



14
15
16
17
# File 'lib/logification/logger.rb', line 14

def initialize(options={})
  name = options[:name] || "logification"
  @base_logger = options[:base_logger] || default_logger(name)
end

Instance Attribute Details

#base_loggerObject

Returns the value of attribute base_logger.



8
9
10
# File 'lib/logification/logger.rb', line 8

def base_logger
  @base_logger
end

#nested_countObject

Returns the value of attribute nested_count.



9
10
11
# File 'lib/logification/logger.rb', line 9

def nested_count
  @nested_count
end

Instance Method Details

#default_logger(name) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/logification/logger.rb', line 19

def default_logger(name)
  Log4r::Logger.new(name).tap do |l|
    l.outputters = Log4r::Outputter.stdout.tap do |o|
      o.formatter = Log4r::PatternFormatter.new(pattern: "%d %.04l [%C] - %M")
    end
    l.level = Log4r::DEBUG
  end
end