Module: Lumberjack::Rails::TaggedForkedLogger

Defined in:
lib/lumberjack/rails/tagged_forked_logger.rb

Overview

Extension for Lumberjack::ForkedLogger to support ActiveSupport tagged logging.

This module adds tagged logging capabilities to forked loggers by delegating tagged calls to the parent logger when available.

Instance Method Summary collapse

Instance Method Details

#tagged(*tags) { ... } ⇒ Object

Execute a block with the specified tags if the parent logger supports tagging.

Parameters:

  • tags (Array)

    the tags to apply during block execution

Yields:

  • the block to execute with the specified tags

Returns:

  • (Object)

    the result of the block execution, or nil if parent doesn’t support tagging



15
16
17
18
19
# File 'lib/lumberjack/rails/tagged_forked_logger.rb', line 15

def tagged(*tags, &block)
  if parent_logger.respond_to?(:tagged)
    parent_logger.tagged(*tags, &block)
  end
end