Created
December 23, 2008 16:08
-
-
Save TwP/39362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logging::Appenders::TimestampRollingFile < Logging::Appenders::RollingFile | |
def initialize( name, opts = {} ) | |
super | |
@date_fmt = '%Y%m%d' | |
@logname_fmt.sub!(%r/\.%d/, '.%s') | |
end | |
def roll_files | |
return unless ::File.exist?(@fn) | |
# rename the base log file | |
::File.rename(@fn, sprintf(@logname_fmt, Time.now.strftime(@date_fmt))) | |
# touch the age file if needed | |
FileUtils.touch(@age_fn) if @age | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment