Module: JsonTaggedLogging
- Defined in:
- lib/json_tagged_logging.rb,
lib/json_tagged_logging/version.rb,
lib/json_tagged_logging/formatter.rb
Overview
Formats logs as JSON
Defined Under Namespace
Modules: Formatter
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(logger) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/json_tagged_logging.rb', line 30 def self.new(logger) logger = logger.dup if logger.formatter logger.formatter = logger.formatter.dup else # Ensure we set a default formatter so we aren't extending nil! logger.formatter = ActiveSupport::Logger::SimpleFormatter.new end logger.formatter.extend JsonTaggedLogging::Formatter logger.extend(self) end |
Instance Method Details
#flush ⇒ Object
50 51 52 53 |
# File 'lib/json_tagged_logging.rb', line 50 def flush super if defined?(super) end |
#tagged(*tags) ⇒ Object
46 47 48 |
# File 'lib/json_tagged_logging.rb', line 46 def tagged(*) formatter.tagged(*) { yield self } end |