Class: Ruborg::RuborgLogger
- Inherits:
-
Object
- Object
- Ruborg::RuborgLogger
- Defined in:
- lib/ruborg/logger.rb
Overview
Logging functionality for ruborg
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize(log_file: nil) ⇒ RuborgLogger
constructor
A new instance of RuborgLogger.
- #warn(message) ⇒ Object
Constructor Details
#initialize(log_file: nil) ⇒ RuborgLogger
Returns a new instance of RuborgLogger.
11 12 13 14 15 16 17 18 19 |
# File 'lib/ruborg/logger.rb', line 11 def initialize(log_file: nil) @log_file = log_file || default_log_file validate_and_ensure_log_directory @logger = Logger.new(@log_file, "daily") @logger.level = Logger::INFO @logger.formatter = proc do |severity, datetime, _progname, msg| "[#{datetime.strftime("%Y-%m-%d %H:%M:%S")}] #{severity}: #{msg}\n" end end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/ruborg/logger.rb', line 9 def logger @logger end |
Instance Method Details
#debug(message) ⇒ Object
33 34 35 |
# File 'lib/ruborg/logger.rb', line 33 def debug() @logger.debug() end |
#error(message) ⇒ Object
25 26 27 |
# File 'lib/ruborg/logger.rb', line 25 def error() @logger.error() end |
#info(message) ⇒ Object
21 22 23 |
# File 'lib/ruborg/logger.rb', line 21 def info() @logger.info() end |
#warn(message) ⇒ Object
29 30 31 |
# File 'lib/ruborg/logger.rb', line 29 def warn() @logger.warn() end |