Module: Gallus::Logging

Defined in:
lib/gallus/logging.rb

Overview

Internal: Programmers are lazy, why to initialize logger manually in language like Ruby, when you can use handy one-liner include to have logger available for your class. Example:

class Foo
  include Gallus::Logging

  def initialize
    log.debug("Initializing!")
  end
end

Gallus::Log.configure('Foo') do |log|
  log.level = :DEBUG
  log.output << Gallus::Output::Stdout.new(Gallus::Format::SimpleConsole.new)
end

Foo.new # => "DEBUG: Initializing!"

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



21
22
23
# File 'lib/gallus/logging.rb', line 21

def self.included(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#logObject



25
26
27
# File 'lib/gallus/logging.rb', line 25

def log
  self.class.log
end