0.0
No release in over 3 years
Low commit activity in last 3 years
Enhance Ruby logger with support for key-value metadata.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

 Project Readme

Logger::Metadata

Enhance Ruby logger with support for key-value metadata.

Build Status

Installation

Logger::Metadata is available as a ruby gem.

$ gem install logger-metadata

Usage

require 'logger-metadata'

logger = Logger.new
Logger::Metadata.inject(logger)

logger.metadata(key: 'value') do
  logger.info('message')
end

All log messages within the metadata block will contain the metadata. Nested metadata blocks can be used.

Logger::Metadata will augment the default the default formatter to include metadata and timestamp. For example

[2016-11-30 14:27:19 +0200] Message (key=value)

Rails integration

Rails application is automatically setup by requiring logger/metadata/railtie if Rails is defined.