Module: Faraday::DetailedLogger::TaggedLogging

Extended by:
Forwardable
Defined in:
lib/faraday/detailed_logger/tagged_logging.rb

Overview

This was largely lifted from ActiveSupport::TaggedLogging. Modifications made to remove ActiveSupport dependencies (blank?, delegation, and ActiveSupport::Logger).

Defined Under Namespace

Modules: Formatter

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(logger) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/faraday/detailed_logger/tagged_logging.rb', line 59

def self.new(logger)
  unless logger.respond_to?(:tagged)
    logger.formatter ||= ::Logger::Formatter.new
    logger.formatter.extend Formatter
    logger.extend(self)
  end

  logger
end

Instance Method Details

#flushObject



73
74
75
76
# File 'lib/faraday/detailed_logger/tagged_logging.rb', line 73

def flush
  clear_tags!
  super if defined?(super)
end

#tagged(*tags) ⇒ Object



69
70
71
# File 'lib/faraday/detailed_logger/tagged_logging.rb', line 69

def tagged(*tags)
  formatter.tagged(*tags) { yield self }
end