module Ethon::Loggable

def default_logger

Returns:
  • (Logger) - The default logger.

Other tags:
    Example: Get the default logger. -
def default_logger
  logger = Logger.new($stdout)
  logger.level = Logger::INFO
  logger
end

def logger

Returns:
  • (Logger) - The logger.

Other tags:
    Example: Get the logger. -

Other tags:
    Note: - Will try to grab Rails' logger first before creating a new logger
def logger
  return @logger if defined?(@logger)
  @logger = rails_logger || default_logger
end

def logger=(logger)

Returns:
  • (Logger) - The new logger.

Parameters:
  • logger (Logger) -- The logger to set.

Other tags:
    Example: Set the logger. -
def logger=(logger)
  @logger = logger
end

def rails_logger

Returns:
  • (Logger) - The Rails logger.

Other tags:
    Example: Get Rails' logger. -
def rails_logger
  defined?(::Rails) && ::Rails.respond_to?(:logger) && ::Rails.logger
end