-
Notifications
You must be signed in to change notification settings - Fork 69
Description
This code correctly sets @shift_age to 7 and @shift_size to 1048576
Logger::LogDevice.new(@filename)This code will end up with those instance variables set to nil
logger = Logger::LogDevice.new(STDERR)
logger.reopen(@filename)This could be fixed in LogDevice#initialize by setting the defaults outside of the if @filename condition, or repeating the logic in the LogDevice#reopen.
It would also make sense, though, if you can update the output to be able to also change those values if desired. This could be done by adding an attr_writer for them.
The best course of action would be to support adding/changing the values when a new output is specified. I'm adding a PR with my recommendation.
My specific use case involves a library I'm using instantiating a logger instance for me with STDOUT, and I want to change the output to a file with useful shift values.