Class: Racket::Utils::Application::Logger
- Inherits:
-
Object
- Object
- Racket::Utils::Application::Logger
- Defined in:
- lib/racket/utils/application/logger.rb
Overview
Class for logging messages in the application.
Class Method Summary collapse
-
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
Instance Method Summary collapse
-
#inform_all(message, level = :info) ⇒ Object
Sends a message to the logger.
-
#inform_dev(message, level = :debug) ⇒ Object
Sends a message to the logger, but only if we are running in dev mode.
-
#initialize(logger, mode) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(logger, mode) ⇒ Logger
Returns a new instance of Logger.
36 37 38 39 |
# File 'lib/racket/utils/application/logger.rb', line 36 def initialize(logger, mode) @logger = logger @in_dev_mode = (mode == :dev) end |
Class Method Details
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
29 30 31 32 33 34 |
# File 'lib/racket/utils/application/logger.rb', line 29 def self.service( = {}) lambda do |reg| settings = reg.application_settings new(settings.logger, settings.mode) end end |
Instance Method Details
#inform_all(message, level = :info) ⇒ Object
Sends a message to the logger.
46 47 48 |
# File 'lib/racket/utils/application/logger.rb', line 46 def inform_all(, level = :info) inform(, level) end |
#inform_dev(message, level = :debug) ⇒ Object
Sends a message to the logger, but only if we are running in dev mode.
55 56 57 |
# File 'lib/racket/utils/application/logger.rb', line 55 def inform_dev(, level = :debug) (inform(, level) if @in_dev_mode) && nil end |