Module: Hutch::Logging

Defined Under Namespace

Classes: HutchFormatter

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.loggerObject



20
21
22
# File 'lib/hutch/logging.rb', line 20

def self.logger
  @logger || setup_logger
end

.logger=(logger) ⇒ Object



24
25
26
# File 'lib/hutch/logging.rb', line 24

def self.logger=(logger)
  @logger = logger
end

.setup_logger(target = $stdout) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/hutch/logging.rb', line 12

def self.setup_logger(target = $stdout)
  require 'hutch/config'
  @logger = Logger.new(target)
  @logger.level = Hutch::Config.log_level
  @logger.formatter = HutchFormatter.new
  @logger
end

Instance Method Details

#loggerObject



28
29
30
# File 'lib/hutch/logging.rb', line 28

def logger
  Hutch::Logging.logger
end