Class: Ougai::ChildLogger

Inherits:
Object
  • Object
show all
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

#before_log, #with_fields

Instance Method Summary collapse

Methods included from Logging

#child, #debug, #error, #fatal, #info, #trace, #trace?, #unknown, #warn

Methods included from Logging::Severity

#to_label

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.

Returns:

  • (Boolean)

    true if allows



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.

Returns:

  • (Boolean)

    true if allows



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.

Returns:

  • (Boolean)

    true if allows



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.

Returns:

  • (Boolean)

    true if allows



27
28
29
# File 'lib/ougai/child_logger.rb', line 27

def info?
  @parent.info?
end

#levelObject



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.

Returns:

  • (Boolean)

    true if allows



33
34
35
# File 'lib/ougai/child_logger.rb', line 33

def warn?
  @parent.warn?
end