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.



7
8
9
10
# File 'lib/ougai/child_logger.rb', line 7

def initialize(parent, fields)
  @parent = parent
  @with_fields = fields
end

Instance Method Details

#chain(severity, args, fields, hooks) ⇒ Object



47
48
49
50
# File 'lib/ougai/child_logger.rb', line 47

def chain(severity, args, fields, hooks)
  hooks.push(@before_log) if @before_log
  @parent.chain(severity, args, merge_fields(@with_fields, fields), hooks)
end

#debug?Boolean

Whether the current severity level allows for logging DEBUG.

Returns:

  • (Boolean)

    true if allows



18
19
20
# File 'lib/ougai/child_logger.rb', line 18

def debug?
  @parent.debug?
end

#error?Boolean

Whether the current severity level allows for logging ERROR.

Returns:

  • (Boolean)

    true if allows



36
37
38
# File 'lib/ougai/child_logger.rb', line 36

def error?
  @parent.error?
end

#fatal?Boolean

Whether the current severity level allows for logging FATAL.

Returns:

  • (Boolean)

    true if allows



42
43
44
# File 'lib/ougai/child_logger.rb', line 42

def fatal?
  @parent.fatal?
end

#info?Boolean

Whether the current severity level allows for logging INFO.

Returns:

  • (Boolean)

    true if allows



24
25
26
# File 'lib/ougai/child_logger.rb', line 24

def info?
  @parent.info?
end

#levelObject



12
13
14
# File 'lib/ougai/child_logger.rb', line 12

def level
  @parent.level
end

#warn?Boolean

Whether the current severity level allows for logging WARN.

Returns:

  • (Boolean)

    true if allows



30
31
32
# File 'lib/ougai/child_logger.rb', line 30

def warn?
  @parent.warn?
end