Class: Loggable::Logfmt::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/loggable/logfmt/logger.rb

Overview

A structured logger that formats log messages in a key-value style using Logfmt formatting This has been adapted from github.com/cyberdelia/logfmt-ruby/

Defined Under Namespace

Classes: KeyValueFormatter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs) ⇒ Logger

Returns a new instance of Logger.



12
13
14
15
# File 'lib/loggable/logfmt/logger.rb', line 12

def initialize(*args, **kwargs)
  super
  @formatter ||= KeyValueFormatter.new
end

Class Method Details

.include_logger_silenceObject

Include the LoggerSilence module to fix the incompatibility with ActiveSupport::LoggerSilence whe Rails.application.config.assets.quiet option is set to true, but do not include the module for the test environment as it causes issues with ActiveSupport::LoggerThreadSafeLevel::IsolatedExecutionState.



20
21
22
# File 'lib/loggable/logfmt/logger.rb', line 20

def self.include_logger_silence
  include ActiveSupport::LoggerSilence
end