Class: Enceladus::Logger
- Inherits:
-
Logger
- Object
- Logger
- Enceladus::Logger
- Includes:
- Singleton
- Defined in:
- lib/enceladus/logger.rb
Overview
Logger is a class implemented by using the singleton pattern mainly responsible for loggin requests, responses and exceptions. Examples:
Enceladus::Logger.log.error { "Woops! Something when wrong..." }
Enceladus::Logger.log.info { "Yay! That works like a charm!" }
Enceladus::Logger.log.warn { "Hummm... code smells here..." }
Enceladus::Logger.log.fatal { "Game over..." }
Constant Summary collapse
- @@logger_output =
By default Enceladus::Logger logs messages to STDOUT and the default log level is Logger::ERROR (check out www.ruby-doc.org/stdlib-2.0.0/libdoc/logger/rdoc/Logger.html#class-Logger-label-Description for more information).
STDOUT
Class Method Summary collapse
-
.logger_output ⇒ Object
Returns the current logger output.
-
.logger_output=(output) ⇒ Object
Defines where to log messages.
- .new ⇒ Object
Instance Method Summary collapse
-
#disable_debug_mode! ⇒ Object
Disables the debug mode by changing the log level to ERROR.
-
#enable_debug_mode! ⇒ Object
Changes the log level to DEBUG.
Class Method Details
.logger_output ⇒ Object
Returns the current logger output. Example:
Enceladus::Logger.logger_output
=> "/Users/john/super_project/log/enceladus.log"
39 40 41 |
# File 'lib/enceladus/logger.rb', line 39 def logger_output @@logger_output end |
.logger_output=(output) ⇒ Object
Defines where to log messages. Example:
Enceladus::Logger.logger_output = Rails.root.join("log", "enceladus.log")
30 31 32 |
# File 'lib/enceladus/logger.rb', line 30 def logger_output=(output) @@logger_output = output end |
.new ⇒ Object
18 19 20 21 22 |
# File 'lib/enceladus/logger.rb', line 18 def new super(logger_output).tap do |logger| logger.disable_debug_mode! end end |