Class: Rookout::Logger
- Inherits:
-
Object
- Object
- Rookout::Logger
- Includes:
- Singleton
- Defined in:
- lib/rookout/logger.rb
Defined Under Namespace
Classes: LogRecord
Constant Summary collapse
- LOG_LEVELS =
[:DEBUG, :INFO, :WARNING, :ERROR].freeze
Instance Method Summary collapse
- #debug(message, *args) ⇒ Object
- #error(message, *args) ⇒ Object
- #exception(message, exc) ⇒ Object
- #info(message, *args) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #register_output(output) ⇒ Object
- #remove_output(_output) ⇒ Object
- #warning(message, *args) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rookout/logger.rb', line 13 def initialize # Detect unit tests if (Config.debug || $PROGRAM_NAME.end_with?("minitest_runner.rb") || $PROGRAM_NAME.end_with?("tunit_or_minitest_in_folder_runner.rb")) && Dir.pwd.end_with?("ruby-sdk") Config.logger_log_level = :DEBUG Config.logger_log_to_stderr = true end @verbosity = LOG_LEVELS.index(Config.logger_log_level) || LOG_LEVELS.index(:INFO) @output = nil @handlers = [] build_handlers end |
Instance Method Details
#debug(message, *args) ⇒ Object
38 39 40 |
# File 'lib/rookout/logger.rb', line 38 def debug , *args log :DEBUG, , args end |
#error(message, *args) ⇒ Object
50 51 52 |
# File 'lib/rookout/logger.rb', line 50 def error , *args log :ERROR, , args end |
#exception(message, exc) ⇒ Object
54 55 56 |
# File 'lib/rookout/logger.rb', line 54 def exception , exc error , exc end |
#info(message, *args) ⇒ Object
42 43 44 |
# File 'lib/rookout/logger.rb', line 42 def info , *args log :INFO, , args end |
#register_output(output) ⇒ Object
30 31 32 |
# File 'lib/rookout/logger.rb', line 30 def register_output output @output = output end |
#remove_output(_output) ⇒ Object
34 35 36 |
# File 'lib/rookout/logger.rb', line 34 def remove_output _output @output = nil end |
#warning(message, *args) ⇒ Object
46 47 48 |
# File 'lib/rookout/logger.rb', line 46 def warning , *args log :WARNING, , args end |