mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Dont log timestamp on Heroku, fixes #2343
This commit is contained in:
parent
1f7d52eb6e
commit
607e63cb25
2 changed files with 8 additions and 1 deletions
|
@ -4,6 +4,7 @@ HEAD
|
|||
- Set a `created_at` attribute when jobs are created, set `enqueued_at` only
|
||||
when they go into a queue. Fixes invalid latency calculations with scheduled jobs.
|
||||
[#2373, mrsimo]
|
||||
- Don't log timestamp on Heroku [#2343]
|
||||
|
||||
3.3.4
|
||||
-----------
|
||||
|
|
|
@ -18,6 +18,12 @@ module Sidekiq
|
|||
end
|
||||
end
|
||||
|
||||
class WithoutTimestamp < Pretty
|
||||
def call(severity, time, program_name, message)
|
||||
"#{::Process.pid} TID-#{Thread.current.object_id.to_s(36)}#{context} #{severity}: #{message}\n"
|
||||
end
|
||||
end
|
||||
|
||||
def self.with_context(msg)
|
||||
Thread.current[:sidekiq_context] ||= []
|
||||
Thread.current[:sidekiq_context] << msg
|
||||
|
@ -30,7 +36,7 @@ module Sidekiq
|
|||
oldlogger = defined?(@logger) ? @logger : nil
|
||||
@logger = Logger.new(log_target)
|
||||
@logger.level = Logger::INFO
|
||||
@logger.formatter = Pretty.new
|
||||
@logger.formatter = ENV['DYNO'] ? WithoutTimestamp.new : Pretty.new
|
||||
oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging
|
||||
@logger
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue