Class: CustomLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/mangopay/util/custom_logger.rb

Overview

Custom Logger implementation which handles concatenation of multiple provided arguments into the log message string, allowing for much cleaner logging statements.

Direct Known Subclasses

VoidLogger

Instance Method Summary collapse

Instance Method Details

#debug(message, *args) ⇒ Object



8
9
10
# File 'lib/mangopay/util/custom_logger.rb', line 8

def debug(message, *args)
  super(format(message, args))
end

#error(message, *args) ⇒ Object



20
21
22
# File 'lib/mangopay/util/custom_logger.rb', line 20

def error(message, *args)
  super(format(message, args))
end

#fatal(message, *args) ⇒ Object



24
25
26
# File 'lib/mangopay/util/custom_logger.rb', line 24

def fatal(message, *args)
  super(format(message, args))
end

#format(msg, msg_args) ⇒ Object



28
29
30
31
32
33
# File 'lib/mangopay/util/custom_logger.rb', line 28

def format(msg, msg_args)
  msg_args.each do |arg|
    msg.sub! '{}', arg.to_s
  end
  msg
end

#info(message, *args) ⇒ Object



12
13
14
# File 'lib/mangopay/util/custom_logger.rb', line 12

def info(message, *args)
  super(format(message, args))
end

#warn(message, *args) ⇒ Object



16
17
18
# File 'lib/mangopay/util/custom_logger.rb', line 16

def warn(message, *args)
  super(format(message, args))
end