Class: Hoth::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/hoth/util/logger.rb

Class Method Summary collapse

Class Method Details

.debug(msg) ⇒ Object



18
19
20
# File 'lib/hoth/util/logger.rb', line 18

def debug(msg)
  log_provider.debug msg
end

.error(msg) ⇒ Object



30
31
32
# File 'lib/hoth/util/logger.rb', line 30

def error(msg)
  log_provider.error msg
end

.fatal(msg) ⇒ Object



34
35
36
# File 'lib/hoth/util/logger.rb', line 34

def fatal(msg)
  log_provider.fatal msg
end

.info(msg) ⇒ Object



22
23
24
# File 'lib/hoth/util/logger.rb', line 22

def info(msg)
  log_provider.info msg
end

.init_logging!(logfile = "log/hoth.log") ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/hoth/util/logger.rb', line 9

def init_logging!(logfile="log/hoth.log")
  Hoth::Logger.log_provider = if Object.const_defined?("Rails")
    Rails.logger
  else
    require 'logger'
    ::Logger.new(logfile)
  end
end

.log_providerObject



38
39
40
# File 'lib/hoth/util/logger.rb', line 38

def log_provider
  @log_provider || init_logging!
end

.log_provider=(log_provider) ⇒ Object



5
6
7
# File 'lib/hoth/util/logger.rb', line 5

def log_provider=(log_provider)
  @log_provider = log_provider
end

.warn(msg) ⇒ Object



26
27
28
# File 'lib/hoth/util/logger.rb', line 26

def warn(msg)
  log_provider.warn msg
end