Skip to content

Instantly share code, notes, and snippets.

@tulios
Created November 17, 2010 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tulios/703199 to your computer and use it in GitHub Desktop.
Save tulios/703199 to your computer and use it in GitHub Desktop.
log_formatter
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