Class: Logification::Logger
- Inherits:
-
Object
- Object
- Logification::Logger
- Includes:
- Helpers::LoggingMethods, Helpers::Wrapper
- Defined in:
- lib/logification/logger.rb
Constant Summary
Constants included from Helpers::LoggingMethods
Instance Attribute Summary collapse
-
#base_logger ⇒ Object
Returns the value of attribute base_logger.
-
#nested_count ⇒ Object
Returns the value of attribute nested_count.
Instance Method Summary collapse
- #default_logger(name) ⇒ Object
-
#initialize(options = {}) ⇒ Logger
constructor
A new instance of Logger.
Methods included from Helpers::Wrapper
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(={}) name = [:name] || "logification" @base_logger = [:base_logger] || default_logger(name) end |
Instance Attribute Details
#base_logger ⇒ Object
Returns the value of attribute base_logger.
8 9 10 |
# File 'lib/logification/logger.rb', line 8 def base_logger @base_logger end |
#nested_count ⇒ Object
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 |