Module: GemLogger

Defined in:
lib/gem_logger/gem_logger.rb,
lib/gem_logger/version.rb,
lib/gem_logger/basic_logger.rb,
lib/gem_logger/logger_support.rb,
lib/gem_logger/context_handler.rb,
lib/gem_logger/log4r_handler/context_handler.rb

Overview

To configure gem_logger, add something like the following to an initializer (defaults shown):

GemLogger.configure do |config|

  # The default logger instance to use
  # (optional, defaults to Logger.new)
  config.default_logger = CustomLogger.new

  # module to include when GemLogger::LoggerSupport is included
  # (optional, defaults to GemLogger::BasicLogger)
  config.logger_concern = SomeModule

end

Defined Under Namespace

Modules: BasicLogger, ContextHandler, Log4rHandler, LoggerSupport

Constant Summary collapse

VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.context_handlerObject

Returns the value of attribute context_handler


23
24
25
# File 'lib/gem_logger/gem_logger.rb', line 23

def context_handler
  @context_handler
end

.logger_concernObject

The logger concern (ActiveSupport::Concern) to include when clients include GemLogger::Logger The module needs to cause a class level “logger” method (returning the logger instance) to be defined on the client


22
23
24
# File 'lib/gem_logger/gem_logger.rb', line 22

def logger_concern
  @logger_concern
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Allows configuring via class accessors

Yields:

  • (_self)

Yield Parameters:

  • _self (GemLogger)

    the object that the method was called on


41
42
43
# File 'lib/gem_logger/gem_logger.rb', line 41

def self.configure
  yield self
end

.default_loggerObject

The default_logger to use with GemLogger::BasicLogger


31
32
33
# File 'lib/gem_logger/gem_logger.rb', line 31

def self.default_logger
  @default_logger ||= ::Logger.new(STDOUT)
end

.default_logger=(default_logger) ⇒ Object

Set the default_logger to use with GemLogger::BasicLogger


36
37
38
# File 'lib/gem_logger/gem_logger.rb', line 36

def self.default_logger=(default_logger)
  @default_logger = default_logger
end