Sha256: 6922e32f22d8ef36f8186c9898fdf8edd86dc15aaa673b8d4f1e8f1985fc98bc

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

require 'logger'

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

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

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

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mangopay-v4-4.1.0 lib/mangopay/util/custom_logger.rb
mangopay-v4-4.0.2 lib/mangopay/util/custom_logger.rb
mangopay-v4-4.0.1 lib/mangopay/util/custom_logger.rb