Created
November 17, 2010 09:41
-
-
Save tulios/703199 to your computer and use it in GitHub Desktop.
log_formatter
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 LogFormatter | |
def call(severity, time, program_name, message) | |
datetime = time.strftime("%d/%m/%Y %H:%M:%S") | |
process = "rails[#{$PID}]" | |
hostname = Socket.gethostname.split('.')[0] | |
message = (String === message ? | |
message : message.inspect).gsub(/\n/, '').strip | |
"#{datetime} #{hostname} #{process}: #{message}\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment