lib/review/logger.rb in review-5.1.1 vs lib/review/logger.rb in review-5.2.0

- old
+ new

@@ -5,10 +5,34 @@ def initialize(io = $stderr, progname: '--') super(io, progname: progname) self.formatter = ->(severity, _datetime, name, msg) { "#{severity} #{name}: #{msg}\n" } end + def warn(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + + def error(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + + def debug(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + def ttylogger? nil end def success(_log) @@ -17,9 +41,33 @@ end begin require 'tty-logger' class TTYLogger < ::TTY::Logger + def warn(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + + def error(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + + def debug(msg, location: nil) + if location + super("#{location}: #{msg}") + else + super(msg) + end + end + def ttylogger? true end end rescue LoadError