Class: ReVIEW::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(io = $stderr, progname: '--') ⇒ Logger

Returns a new instance of Logger.



5
6
7
8
# File 'lib/review/logger.rb', line 5

def initialize(io = $stderr, progname: '--')
  super(io, progname: progname)
  self.formatter = ->(severity, _datetime, name, msg) { "#{severity} #{name}: #{msg}\n" }
end

Instance Method Details

#debug(msg, location: nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/review/logger.rb', line 26

def debug(msg, location: nil)
  if location
    super("#{location}: #{msg}")
  else
    super(msg)
  end
end

#error(msg, location: nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/review/logger.rb', line 18

def error(msg, location: nil)
  if location
    super("#{location}: #{msg}")
  else
    super(msg)
  end
end

#success(_log) ⇒ Object



38
39
40
# File 'lib/review/logger.rb', line 38

def success(_log)
  # empty (for backward compatibility)
end

#ttylogger?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/review/logger.rb', line 34

def ttylogger?
  nil
end

#warn(msg, location: nil) ⇒ Object



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

def warn(msg, location: nil)
  if location
    super("#{location}: #{msg}")
  else
    super(msg)
  end
end