Class: Giblog

Inherits:
Object
  • Object
show all
Defined in:
lib/giblish/utils.rb

Overview

The logger used from within giblish

Defined Under Namespace

Classes: GiblogFormatter

Class Method Summary collapse

Class Method Details

.loggerObject

returns the application-wide logger instance.



25
26
27
28
29
30
31
32
# File 'lib/giblish/utils.rb', line 25

def self.logger
  unless defined? @logger
    puts "!!!! Error: Trying to access logger before setup !!!!"
    puts caller
    exit
  end
  @logger
end

.setup(logger = nil) ⇒ Object

bootstrap the application-wide logger object



16
17
18
19
20
21
22
# File 'lib/giblish/utils.rb', line 16

def self.setup(logger = nil)
  @logger = logger unless logger.nil?
  return if defined? @logger

  @logger = Logger.new($stdout)
  @logger.formatter = GiblogFormatter.new
end