Class: NewRelic::Agent::Logging::DecoratingLogger
- Inherits:
-
Object
- Object
- NewRelic::Agent::Logging::DecoratingLogger
- Defined in:
- lib/new_relic/agent/logging.rb
Overview
This logger decorates logs with trace and entity metadata, and emits log messages formatted as JSON objects. It extends the Logger class from the Ruby standard library, and accepts the same constructor parameters.
It aliases the ‘:info` message to overwrite the `:write` method, so it can be used in Rack applications that expect the logger to be a file-like object.
It can be added to an application like this:
require 'newrelic_rpm'
config.logger = NewRelic::Agent::Logging::DecoratingLogger.new "log/application.log"
Instance Method Summary collapse
-
#initialize(*args, **kwargs) ⇒ DecoratingLogger
constructor
A new instance of DecoratingLogger.
Constructor Details
#initialize(*args, **kwargs) ⇒ DecoratingLogger
Returns a new instance of DecoratingLogger.
169 170 171 172 |
# File 'lib/new_relic/agent/logging.rb', line 169 def initialize(*args) super(*args) self.formatter = DecoratingFormatter.new end |