Class: Mongo::Logger

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

Overview

Provides ability to log messages.

Since:

  • 2.0.0

Class Method Summary collapse

Class Method Details

.levelInteger

Get the global logger level.

Examples:

Get the global logging level.

Mongo::Logger.level

Returns:

  • (Integer)

    The log level.

Since:

  • 2.0.0



62
63
64
# File 'lib/mongo/logger.rb', line 62

def level
  logger.level
end

.level=(level) ⇒ Integer

Set the global logger level.

Examples:

Set the global logging level.

Mongo::Logger.level == Logger::DEBUG

Returns:

  • (Integer)

    The log level.

Since:

  • 2.0.0



74
75
76
# File 'lib/mongo/logger.rb', line 74

def level=(level)
  logger.level = level
end

.logger::Logger

Get the wrapped logger. If none was set will return a default info level logger.

Examples:

Get the wrapped logger.

Mongo::Logger.logger

Returns:

  • (::Logger)

    The wrapped logger.

Since:

  • 2.0.0



36
37
38
# File 'lib/mongo/logger.rb', line 36

def logger
  @logger ||= default_logger
end

.logger=(other) ⇒ ::Logger

Set the logger.

Examples:

Set the wrapped logger.

Mongo::Logger.logger = logger

Parameters:

  • other (::Logger)

    The logger to set.

Returns:

  • (::Logger)

    The wrapped logger.

Since:

  • 2.0.0



50
51
52
# File 'lib/mongo/logger.rb', line 50

def logger=(other)
  @logger = other
end