Skip to content

Instantly share code, notes, and snippets.

@katpadi
Created June 1, 2016 12:10
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 katpadi/87edc24445d64ef25bf956c79717f1ee to your computer and use it in GitHub Desktop.
Save katpadi/87edc24445d64ef25bf956c79717f1ee to your computer and use it in GitHub Desktop.
basic logger
class StellarLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
logfile = File.open("#{Rails.root}/log/stellar.log", 'a') # create log file
logfile.sync = true # automatically flushes data to file
STELLAR_LOGGER = StellarLogger.new(logfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment