Logger class patch for hourly log rotation support
Ruby 2.3, 2.4, 2.5, 2.6 or 2.7
gem install hourly_logger_rotator
andrequire "hourly_logger_rotation"
- Or add it to your Gemfile and
bundle
Requiring the gem automatically adds an hourly
rotation period support to Ruby's standard
Logger class. You can initialize it like this:
Logger.new('some_log_file', 'hourly')
Keep in mind that loggers created before the gem is required will not
support the hourly rotation period. Specifically, in case of a Rails app,
require this before Rails initializes; a good place to do that is in application.rb
right after requiring boot
HourlyLoggerRotator.default_rotation_period=(some_period)
will make it so newly created
loggers have a rotation period of some_period
unless you provide an explicit
period in the constructor
Released under MIT License
Created by Dmitry Gubitskiy