Class: Focuslight::Logger::Config

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

Class Method Summary collapse

Class Method Details

.log_level(log_level = Focuslight::Config.get(:log_level)) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/focuslight/logger.rb', line 52

def self.log_level(log_level = Focuslight::Config.get(:log_level))
  case log_level
  when 'debug'
    ::Logger::DEBUG
  when 'info'
    ::Logger::INFO
  when 'warn'
    ::Logger::WARN
  when 'error'
    ::Logger::ERROR
  when 'fatal'
    ::Logger::FATAL
  else
    raise ArgumentError, "invalid log_level #{log_level}"
  end
end

.log_path(log_path = Focuslight::Config.get(:log_path)) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/focuslight/logger.rb', line 41

def self.log_path(log_path = Focuslight::Config.get(:log_path))
  case log_path
  when 'STDOUT'
    $stdout
  when 'STDERR'
    $stderr
  else
    log_path
  end
end

.log_shift_age(log_shift_age = Focuslight::Config.get(:log_shift_age)) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/focuslight/logger.rb', line 69

def self.log_shift_age(log_shift_age = Focuslight::Config.get(:log_shift_age))
  case log_shift_age
  when /\d+/
    log_shift_age.to_i
  when 'daily'
    log_shift_age
  when 'weekly'
    log_shift_age
  when 'monthly'
    log_shift_age
  else
    raise ArgumentError, "invalid log_shift_age #{log_shift_age}"
  end
end

.log_shift_size(log_shift_size = Focuslight::Config.get(:log_shift_size)) ⇒ Object



84
85
86
# File 'lib/focuslight/logger.rb', line 84

def self.log_shift_size(log_shift_size = Focuslight::Config.get(:log_shift_size))
  log_shift_size.to_i
end