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



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

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



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

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

.logger::Logger

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

Examples:

Get the wrapped logger.

Mongo::Logger.logger

Returns:

Since:

  • 2.0.0



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

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:

Since:

  • 2.0.0



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

def logger=(other)
  @logger = other
end