Module: Moped::Logging

Included in:
Moped
Defined in:
lib/moped/logging.rb

Overview

Contains behaviour for logging.

Instance Method Summary collapse

Instance Method Details

#default_loggerLogger

Get the default logger.

Examples:

Get the default logger.

Logging.default_logger

Returns:

  • (Logger)

    The default logger.

Since:

  • 1.0.0



39
40
41
42
43
# File 'lib/moped/logging.rb', line 39

def default_logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::INFO
  logger
end

#loggerLogger

Get the logger.

Examples:

Get the logger.

Logging.logger

Returns:

  • (Logger)

    The logger.

Since:

  • 1.0.0



14
15
16
17
# File 'lib/moped/logging.rb', line 14

def logger
  return @logger if defined?(@logger)
  @logger = rails_logger || default_logger
end

#logger=(logger) ⇒ Logger

Set the logger.

Examples:

Set the logger.

Logging.logger = logger

Returns:

  • (Logger)

    The logger.

Since:

  • 1.0.0



53
54
55
# File 'lib/moped/logging.rb', line 53

def logger=(logger)
  @logger = logger
end

#rails_loggerLogger

Get the rails logger.

Examples:

Get the rails logger.

Logging.rails_logger

Returns:

  • (Logger)

    The Rails logger.

Since:

  • 1.0.0



27
28
29
# File 'lib/moped/logging.rb', line 27

def rails_logger
  defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
end