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.



35
36
37
# File 'lib/mongoid/logger.rb', line 35

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:



25
26
27
# File 'lib/mongoid/logger.rb', line 25

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.



15
16
17
# File 'lib/mongoid/logger.rb', line 15

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