Module: MarkLogic::Loggable

Included in:
MarkLogic, Connection, Persistence
Defined in:
lib/marklogic/loggable.rb

Instance Method Summary collapse

Instance Method Details

#default_loggerLogger

Get the default logger.

Examples:

Get the default logger.

Logging.default_logger

Returns:

  • (Logger)

    The default logger.

Since:

  • 1.0.0



27
28
29
30
31
# File 'lib/marklogic/loggable.rb', line 27

def default_logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::DEBUG
  logger
end

#loggerObject



3
4
5
# File 'lib/marklogic/loggable.rb', line 3

def logger
  @logger ||= (rails_logger || default_logger)
end

#logger=(logger) ⇒ Logger

Set the logger.

Examples:

Set the logger.

Logging.logger = logger

Returns:

  • (Logger)

    The logger.

Since:

  • 1.0.0



41
42
43
# File 'lib/marklogic/loggable.rb', line 41

def logger=(logger)
  @logger = logger
end

#rails_loggerLogger

Get the rails logger.

Examples:

Get the rails logger.

Logging.rails_logger

Returns:

  • (Logger)

    The Rails logger.

Since:

  • 1.0.0



15
16
17
# File 'lib/marklogic/loggable.rb', line 15

def rails_logger
  Rails.logger if defined?(Rails) && Rails.respond_to?(:logger)
end