module Restforce::DB::Loggable
Restforce::DB::Loggable
defines shared behaviors for objects which need access to generic logging functionality.
Public Class Methods
included(base)
click to toggle source
Public: Add a ‘logger` attribute to the object including this module.
base - The object which is including the ‘Loggable` module.
# File lib/restforce/db/loggable.rb, line 12 def self.included(base) base.send :attr_accessor, :logger end
Private Instance Methods
error(exception)
click to toggle source
Internal: Log an error for the worker, outputting the entire error stacktrace and applying the appropriate log level.
exception - An Exception object.
Returns nothing.
# File lib/restforce/db/loggable.rb, line 35 def error(exception) log exception, :error end
log(text, level = :info)
click to toggle source
Internal: Log the passed text at the specified level.
text - The piece of text which should be logged for this worker. level - The level at which the text should be logged. Defaults to :info.
Returns nothing.
# File lib/restforce/db/loggable.rb, line 24 def log(text, level = :info) return unless logger logger.send(level, text) end