Class: Krikri::Logger
- Inherits:
-
Object
- Object
- Krikri::Logger
- Defined in:
- lib/krikri/logger.rb
Overview
An application-wide tagged logger
Class Method Summary collapse
-
.log(priority, msg) ⇒ Object
Initializes a logger with the default settings and logs a message to it.
Instance Method Summary collapse
-
#initialize(logger = ActiveSupport::TaggedLogging.new(Rails.logger)) ⇒ Logger
constructor
A new instance of Logger.
-
#log(priority, msg) ⇒ Object
Log a message, tagged for application-wide consistency.
Constructor Details
#initialize(logger = ActiveSupport::TaggedLogging.new(Rails.logger)) ⇒ Logger
Returns a new instance of Logger.
14 15 16 |
# File 'lib/krikri/logger.rb', line 14 def initialize(logger = ActiveSupport::TaggedLogging.new(Rails.logger)) @logger = logger end |
Class Method Details
.log(priority, msg) ⇒ Object
Initializes a logger with the default settings and logs a message to it
22 23 24 |
# File 'lib/krikri/logger.rb', line 22 def log(priority, msg) new.log(priority, msg) end |
Instance Method Details
#log(priority, msg) ⇒ Object
Log a message, tagged for application-wide consistency
32 33 34 35 36 |
# File 'lib/krikri/logger.rb', line 32 def log(priority, msg) @logger.tagged(Time.now.to_s, Process.pid, to_s) do @logger.send(priority, msg) end end |