Class: BackgroundQueue::Worker::LogFormatter
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- BackgroundQueue::Worker::LogFormatter
- Defined in:
- lib/background_queue/worker/logger.rb
Overview
custom log formatter
Constant Summary collapse
- Format =
"%s %5s [%s] %s\n"
Instance Method Summary collapse
- #call(severity, time, progname, msg) ⇒ Object
-
#initialize(task_key) ⇒ LogFormatter
constructor
A new instance of LogFormatter.
Constructor Details
#initialize(task_key) ⇒ LogFormatter
Returns a new instance of LogFormatter.
80 81 82 83 |
# File 'lib/background_queue/worker/logger.rb', line 80 def initialize(task_key) @datetime_format = "%Y-%m-%d %H:%M:%S" @task_key = task_key end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
85 86 87 |
# File 'lib/background_queue/worker/logger.rb', line 85 def call(severity, time, progname, msg) Format % [@task_key, severity, format_datetime(time), msg2str(msg)] end |