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
16 17 18 19 20 21 22 |
# File 'lib/dataduck/logs.rb', line 16 def Logs.debug() self.ensure_logger_exists! = Logs.() puts "[DEBUG] #{ }" @@logger.debug() end |
.ensure_logger_exists! ⇒ Object
10 11 12 13 14 |
# File 'lib/dataduck/logs.rb', line 10 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
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/dataduck/logs.rb', line 40 def Logs.error(err, = nil) self.ensure_logger_exists! = err.to_s unless = Logs.() puts "[ERROR] #{ }" @@logger.error() if ENV['SENTRY_DSN'] Raven.capture_exception(err) end end |