Class: Mongoid::Logger

Inherits:
Object show all
Defined in:
lib/mongoid/logger.rb

Overview

The Mongoid logger which wraps some other ruby compliant logger class.

Instance Method Summary collapse

Instance Method Details

#inspectString

Inspect the logger.

Examples:

Inspect the logger.

logger.inspect

Returns:

  • (String)

    The logger, inspected.



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

def inspect
  "#<Mongoid::Logger:0x#{object_id.to_s(16)} @logger=#{logger.inspect}>"
end

#loggerLogger

Get the mongoid logger.

Examples:

Get the global logger.

logger.logger

Returns:



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

def logger
  Mongoid.logger
end

#warn(message) ⇒ Object

Emit a warning log message.

Examples:

Log a warning.

logger.warn("Danger")

Parameters:

  • message (String)

    The warning message.



21
22
23
# File 'lib/mongoid/logger.rb', line 21

def warn(message)
  logger.warn(message) if logger && logger.respond_to?(:warn)
end