Created
February 11, 2009 14:12
-
-
Save blaix/62023 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
# A logger that isn't lame: | |
class AuditLogger < Logger | |
def initialize(path_to_logfile) | |
log_file = File.open(path_to_logfile, 'a') | |
log_file.sync = true | |
super(log_file) | |
end | |
def format_message(severity, timestamp, progname, msg) | |
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n" | |
end | |
end | |
# logger = AuditLogger.new("./log/mylog.log") | |
# logger.info("This will show up right away and not be ugly.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment