Class: Justimmo::Logger

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

Overview

The Justimmo logger.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Logger

Returns a new instance of Logger.


10
11
12
13
14
15
16
17
# File 'lib/justimmo/logger.rb', line 10

def initialize(config)
  super(STDOUT)

  self.level = config.debug? ? Logger::DEBUG : Logger::INFO
  self.formatter = proc do |severity, datetime, _progname, msg|
    "#{severity}  [#{datetime}]  #{msg}\n"
  end
end

Class Method Details

.configure(config) ⇒ Object


20
21
22
# File 'lib/justimmo/logger.rb', line 20

def configure(config)
  @logger = new(config)
end

.debug(*args) ⇒ Object


24
25
26
# File 'lib/justimmo/logger.rb', line 24

def debug(*args)
  @logger&.debug(*args)
end

.error(*args) ⇒ Object


36
37
38
# File 'lib/justimmo/logger.rb', line 36

def error(*args)
  @logger&.error(*args)
end

.info(*args) ⇒ Object


28
29
30
# File 'lib/justimmo/logger.rb', line 28

def info(*args)
  @logger&.info(*args)
end

.warn(*args) ⇒ Object


32
33
34
# File 'lib/justimmo/logger.rb', line 32

def warn(*args)
  @logger&.warn(*args)
end