Rails logger plugin for logging to LogDNA
This gem contains LogDNA::RailsLogger, a plugin for ActiveSupport::Logger from Rails.
Add this line to your application's Gemfile:
gem 'logdna-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install logdna-rails
Instantiates a new instance of the class it is called on. api_key and hostname are required.
Options:
- logdev: The log device. This is a filename (String) or IO object (e.g. STDOUT, STDERR, an open file). Default: STDOUT.
- shift_age: Number of old log files to keep, or frequency of rotation (daily, weekly, or monthly). Default: 7.
- shift_size: Maximum logfile size (only applies when shift_age is a number). Default: 1,048,576
- buffer_max_size: Maximum number of lines in buffer.
- buffer_timeout: Frequency of posting requests to LogDNA.
- mac: MAC address. Default: nil.
- ip: IP address. Default: nil.
Log a message if the given severity is high enough and post it to the LogDNA ingester. This is the generic logging method. Users will be more inclined to use debug, info, warn, error, and fatal (which all call #add), as described in the Ruby Logger documentation. Note that these methods take a source as the argument and a block which returns a message. It returns the http response.
Close the HTTP connection to LogDNA's ingester.
Open another HTTP connection to LogDNA's ingester if the connection is alread closed.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome on GitHub at https://github.com/logdna/rails.
The gem is available as open source under the terms of the MIT License.