Alephant::Logger::JSON
JSON logging driver for the alephant-logger gem.
Installation
Add this line to your application's Gemfile:
gem 'alephant-logger-json'
And then execute:
$ bundle
Or install it yourself as:
$ gem install alephant-logger-json
Usage
require "alephant/logger"
require "alephant/logger/json"
json_driver = Alephant::Logger::JSON.new "path/to/logfile.log"
logger = Alephant::Logger.setup json_driver
logger.info({ "some_field" => "some_value", "other_field" => "other_value" })
By default, nested JSON values are flattened to strings. To enable nesting,
provided that your log analysis tooling supports that, create
Alephant::Logger::JSON as follows:
Alephant::Logger::JSON.new("path/to/logfile.log", :nesting => true)
Contributing
- Fork it ( https://github.com/BBC-News/alephant-logger-json/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request