Class: Ougai::ChildLogger
- Inherits:
-
Object
- Object
- Ougai::ChildLogger
- Includes:
- Logging
- Defined in:
- lib/ougai/child_logger.rb
Overview
A logger created by the ‘child` method of parent logger
Constant Summary
Constants included from Logging::Severity
Logging::Severity::SEV_LABEL, Logging::Severity::TRACE
Instance Attribute Summary
Attributes included from Logging
Instance Method Summary collapse
- #chain(severity, args, fields, hooks) ⇒ Object
-
#debug? ⇒ Boolean
Whether the current severity level allows for logging DEBUG.
-
#error? ⇒ Boolean
Whether the current severity level allows for logging ERROR.
-
#fatal? ⇒ Boolean
Whether the current severity level allows for logging FATAL.
-
#info? ⇒ Boolean
Whether the current severity level allows for logging INFO.
-
#initialize(parent, fields) ⇒ ChildLogger
constructor
A new instance of ChildLogger.
- #level ⇒ Object
-
#warn? ⇒ Boolean
Whether the current severity level allows for logging WARN.
Methods included from Logging
#child, #debug, #error, #fatal, #info, #trace, #trace?, #unknown, #warn
Methods included from Logging::Severity
Constructor Details
#initialize(parent, fields) ⇒ ChildLogger
Returns a new instance of ChildLogger.
9 10 11 12 13 |
# File 'lib/ougai/child_logger.rb', line 9 def initialize(parent, fields) @before_log = nil @parent = parent @with_fields = fields end |
Instance Method Details
#chain(severity, args, fields, hooks) ⇒ Object
50 51 52 53 |
# File 'lib/ougai/child_logger.rb', line 50 def chain(severity, args, fields, hooks) hooks.push(@before_log) if @before_log @parent.chain(severity, args, weak_merge!(fields, @with_fields), hooks) end |
#debug? ⇒ Boolean
Whether the current severity level allows for logging DEBUG.
21 22 23 |
# File 'lib/ougai/child_logger.rb', line 21 def debug? @parent.debug? end |
#error? ⇒ Boolean
Whether the current severity level allows for logging ERROR.
39 40 41 |
# File 'lib/ougai/child_logger.rb', line 39 def error? @parent.error? end |
#fatal? ⇒ Boolean
Whether the current severity level allows for logging FATAL.
45 46 47 |
# File 'lib/ougai/child_logger.rb', line 45 def fatal? @parent.fatal? end |
#info? ⇒ Boolean
Whether the current severity level allows for logging INFO.
27 28 29 |
# File 'lib/ougai/child_logger.rb', line 27 def info? @parent.info? end |
#level ⇒ Object
15 16 17 |
# File 'lib/ougai/child_logger.rb', line 15 def level @parent.level end |
#warn? ⇒ Boolean
Whether the current severity level allows for logging WARN.
33 34 35 |
# File 'lib/ougai/child_logger.rb', line 33 def warn? @parent.warn? end |