Module: Mongoid::Loggable

Included in:
Mongoid, Clients::Factory
Defined in:
build/mongoid-7.4/lib/mongoid/loggable.rb

Overview

Contains logging behavior.

Instance Method Summary collapse

Instance Method Details

#loggerLogger

Note:

Will try to grab Rails' logger first before creating a new logger with stderr.

Get the logger.

Examples:

Get the logger.

Loggable.logger

Returns:

  • (Logger)

    The logger.



17
18
19
20
# File 'build/mongoid-7.4/lib/mongoid/loggable.rb', line 17

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

#logger=(logger) ⇒ Logger

Set the logger.

Examples:

Set the logger.

Loggable.logger = Logger.new(STDERR)

Parameters:

  • logger (Logger)

    The logger to set.

Returns:

  • (Logger)

    The new logger.



30
31
32
# File 'build/mongoid-7.4/lib/mongoid/loggable.rb', line 30

def logger=(logger)
  @logger = logger
end