Class: LoggerLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/debugtrace/loggers.rb

Overview

A logger class that outputs using the logging library.

Defined Under Namespace

Classes: Formatter

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ LoggerLogger

Returns a new instance of LoggerLogger.



80
81
82
83
84
85
86
# File 'lib/debugtrace/loggers.rb', line 80

def initialize(config)
  @config = Common::check_type("config", config, Config)
  @logger = Logger.new(
      @config.logging_destination,
      formatter: Formatter.new(@config),
      datetime_format: @config.logging_datetime_format)
end

Instance Method Details

Outputs the message.

Parameters:

  • message (String)

    : The message to output



90
91
92
93
# File 'lib/debugtrace/loggers.rb', line 90

def print(message)
  Common::check_type("message", message, String)
  @logger.log(Logger::Severity::DEBUG, message, 'DebugTrace-rb')
end

#to_sObject

Returns a string representation of this object.

Returns:

  • String: A string representation of this object



97
98
99
# File 'lib/debugtrace/loggers.rb', line 97

def to_s
  'logging.Logger logger'
end