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
25 26 27 28 29 30 31 |
# File 'lib/dataduck/logs.rb', line 25 def Logs.debug() self.ensure_logger_exists! = Logs.() puts "[DEBUG] #{ }" @@logger.debug() end |
.ensure_logger_exists! ⇒ Object
19 20 21 22 23 |
# File 'lib/dataduck/logs.rb', line 19 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
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dataduck/logs.rb', line 49 def Logs.error(err, = nil) self.ensure_logger_exists! = err.to_s unless = Logs.() puts "[ERROR] #{ }" @@logger.error() Logs.third_party_error_tracking!(err) end |