Class: Wurk::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/wurk/logger.rb

Overview

Wurk’s stdlib-compatible ::Logger subclass. The point of subclassing (rather than configuring a vanilla ::Logger) is to ship default formatters that read the thread-local Wurk::Context so every line carries jid/bid/tags/elapsed without callers threading the hash through.

Formatter selection at boot:

- ENV["DYNO"] set        → Formatters::WithoutTimestamp (Heroku already prefixes)
- otherwise              → Formatters::Pretty

Switch to Formatters::JSON manually for log aggregators that want NDJSON.

Spec: docs/target/sidekiq-free.md §29.

Defined Under Namespace

Modules: Formatters

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



70
71
72
73
# File 'lib/wurk/logger.rb', line 70

def initialize(*, **)
  super
  self.formatter = default_formatter
end