Class: RubyWolf::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Logger

Returns a new instance of Logger.



5
6
7
8
9
10
11
# File 'lib/ruby_wolf/logger.rb', line 5

def initialize(*args)
  super(*args)
  @formatter = proc do |severity, datetime, _progname, msg|
    date_format = datetime.strftime('%Y-%m-%d %H:%M:%S')
    "[#{severity.to_s[0]}] [#{date_format}] #{msg}\n"
  end
end

Instance Method Details

#debug(contents = '') ⇒ Object



25
26
27
28
29
# File 'lib/ruby_wolf/logger.rb', line 25

def debug(contents = '')
  pre_process(contents) do |content|
    super(content)
  end
end

#error(contents = '') ⇒ Object



31
32
33
34
35
# File 'lib/ruby_wolf/logger.rb', line 31

def error(contents = '')
  pre_process(contents) do |content|
    super(content)
  end
end

#fatal(contents = '') ⇒ Object



37
38
39
40
41
# File 'lib/ruby_wolf/logger.rb', line 37

def fatal(contents = '')
  pre_process(contents) do |content|
    super(content)
  end
end

#info(contents = '') ⇒ Object



13
14
15
16
17
# File 'lib/ruby_wolf/logger.rb', line 13

def info(contents = '')
  pre_process(contents) do |content|
    super(content)
  end
end

#warn(contents = '') ⇒ Object



19
20
21
22
23
# File 'lib/ruby_wolf/logger.rb', line 19

def warn(contents = '')
  pre_process(contents) do |content|
    super(content)
  end
end