My rails logger configuration currently logs the current time and UUID, like this:
config.logger = ActiveSupport::TaggedLogging.new(Logger.new("#{Rails.root}/log/#{ENV['RAILS_ENV']}.log", 'daily'))
config.log_tags = [Proc.new {Time.now.strftime('%Y-%m-%d %H:%M:%S.%L')}, :uuid]
Is there a way to also log the current message's log level?
i.e., if I call logger.debug, the tag [DEBUG] is added to the message.
Railscasts shows how to override the logger to output the severity of the log message by overriding the SimpleFormatter#call method:
class Logger::SimpleFormatter
def call(severity, time, progname, msg)
"[#{severity}] #{msg}\n"
end
end
See http://railscasts.com/episodes/56-the-logger-revised for the details.