Module: QAT::Logger

Includes:
Log4r
Defined in:
lib/qat/logger/version.rb,
lib/qat/logger/core.rb,
lib/qat/logger/formatter.rb,
lib/qat/logger/outputter/file.rb,
lib/qat/logger/outputter/remote.rb,
lib/qat/logger/outputter/console.rb,
lib/qat/logger/outputter/remote/message.rb

Overview

QAT’s implementation of a logger

Defined Under Namespace

Classes: ConsoleOutputter, Formatter, RemoteOutputter, RollingFileOutputter

Constant Summary collapse

DEFAULT_OUTPUTTER_NAME =

The default outputter for QAT’s logger

'qat_console_outputter'
VERSION =

QAT::Logger version

'9.0.0'

Constants included from Log4r

Log4r::QatConsoleOutputter, Log4r::QatFileOutputter, Log4r::QatFormatter, Log4r::QatRemoteOutputter

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Sets up the logging capabilities for base when QAT::Logger is included in a base module/class.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/qat/logger/core.rb', line 14

def self.included base
  logging_function_code = <<-RUBY
    def log
      log_obj = Log4r::Logger["#{base.name}"]

      unless log_obj
        log_obj = Log4r::Logger.new "#{base.name}"
        log_obj.outputters = Log4r::Outputter[DEFAULT_OUTPUTTER_NAME] || ConsoleOutputter.new(DEFAULT_OUTPUTTER_NAME)
      end

      log_obj
    end
    private :log
  RUBY

  base.module_eval <<-RUBY, __FILE__, __LINE__+1
    #{logging_function_code}
    class << self
      #{logging_function_code}
    end
  RUBY
end