Module: DataDuck::Logs
- Defined in:
- lib/dataduck/logs.rb
Constant Summary collapse
- @@ONE_MB_IN_BYTES =
1048576
- @@logger =
nil
Class Method Summary collapse
- .debug(message) ⇒ Object
- .ensure_logger_exists! ⇒ Object
- .error(err, message = nil) ⇒ Object
- .info(message) ⇒ Object
- .warn(message) ⇒ Object
Class Method Details
.debug(message) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/dataduck/logs.rb', line 15 def Logs.debug() self.ensure_logger_exists! = Logs.() puts "[DEBUG] #{ }" @@logger.debug() end |
.ensure_logger_exists! ⇒ Object
9 10 11 12 13 |
# File 'lib/dataduck/logs.rb', line 9 def Logs.ensure_logger_exists! log_file_path = DataDuck.project_root + '/log/dataduck.log' DataDuck::Util.ensure_path_exists!(log_file_path) @@logger ||= Logger.new(log_file_path, shift_age = 100, shift_size = 100 * @@ONE_MB_IN_BYTES) end |
.error(err, message = nil) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/dataduck/logs.rb', line 39 def Logs.error(err, = nil) self.ensure_logger_exists! = err.to_s unless = Logs.() puts "[ERROR] #{ }" @@logger.error() end |