Class: Logger
- Inherits:
-
Object
- Object
- Logger
- Includes:
- Singleton
- Defined in:
- lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb
Class Method Summary collapse
-
.debug? ⇒ Boolean
Check if debug logging is enabled.
-
.set_debug(value = false) ⇒ Object
Enable or disable debug logging.
Instance Method Summary collapse
-
#error(message) ⇒ Object
Log error message (always shown).
-
#info(message) ⇒ Object
Log info message (always shown).
-
#log(message) ⇒ Object
Log debug message (only if debug is enabled).
-
#success(message) ⇒ Object
Log success message (only if debug is enabled).
-
#timestamp ⇒ String
Generate timestamp for log messages.
-
#warning(message) ⇒ Object
Log warning message (only if debug is enabled).
Class Method Details
.debug? ⇒ Boolean
Check if debug logging is enabled
34 35 36 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 34 def debug? @debug end |
.set_debug(value = false) ⇒ Object
Enable or disable debug logging
28 29 30 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 28 def set_debug(value = false) @debug = value end |
Instance Method Details
#error(message) ⇒ Object
Log error message (always shown)
55 56 57 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 55 def error() puts "#{} ERROR #{colorize(, :red)}" end |
#info(message) ⇒ Object
Log info message (always shown)
77 78 79 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 77 def info() puts "#{} INFO #{colorize(, :blue)}" end |
#log(message) ⇒ Object
Log debug message (only if debug is enabled)
47 48 49 50 51 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 47 def log() return unless self.class.debug? puts "#{} DEBUG #{}" end |
#success(message) ⇒ Object
Log success message (only if debug is enabled)
69 70 71 72 73 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 69 def success() return unless self.class.debug? puts "#{} SUCCESS #{colorize(, :green)}" end |
#timestamp ⇒ String
Generate timestamp for log messages
41 42 43 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 41 def "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} AppConfiguration" end |
#warning(message) ⇒ Object
Log warning message (only if debug is enabled)
61 62 63 64 65 |
# File 'lib/ibm_appconfiguration_ruby_sdk/configurations/internal/logger.rb', line 61 def warning() return unless self.class.debug? puts "#{} WARNING #{colorize(, :yellow)}" end |