Method: RTP::Logging::ClassMethods#logger

Defined in:
lib/rtp-connect/logging.rb

#loggerProxyLogger

The logger object getter.

If a logger instance is not pre-defined, it sets up a Standard logger or (if in a Rails environment) the Rails logger.

Examples:

Inside the RTP module (or a class with 'include RTP::Logging'):

logger # => Logger instance

Accessing from outside the RTP module:

RTP.logger # => Logger instance

Returns:



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/rtp-connect/logging.rb', line 112

def logger
  @@logger ||= lambda {
    if defined?(Rails)
      ProxyLogger.new(Rails.logger)
    else
      l = Logger.new(STDOUT)
      l.level = Logger::INFO
      ProxyLogger.new(l)
    end
  }.call
end