Module: Ethon::Loggable

Included in:
Ethon
Defined in:
lib/ethon/loggable.rb

Overview

Contains logging behaviour.

Instance Method Summary collapse

Instance Method Details

#loggerLogger

Note:

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

Get the logger.

Examples:

Get the logger.

Loggable.logger

Returns:

  • (Logger)

    The logger.


16
17
18
19
# File 'lib/ethon/loggable.rb', line 16

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($stdout)

Parameters:

  • logger (Logger)

    The logger to set.

Returns:

  • (Logger)

    The new logger.


29
30
31
# File 'lib/ethon/loggable.rb', line 29

def logger=(logger)
  @logger = logger
end