Class: Gloo::App::Log

Inherits:
GlooLang::App::Log
  • Object
show all
Defined in:
lib/gloo/app/log.rb

Instance Method Summary collapse

Instance Method Details

#error(msg, ex = nil, engine = nil) ⇒ Object

Write an error message to the log and set the error in the engine’s data heap. Also write to the console unless quiet.



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gloo/app/log.rb', line 37

def error( msg, ex = nil, engine = nil )
  engine&.heap&.error&.set_to msg
  @logger.error msg
  if ex
    @logger.error ex.message
    @logger.error ex.backtrace
    puts msg.red unless @quiet
    puts ex.message.red unless @quiet
    puts ex.backtrace unless @quiet
  else
    puts msg.red unless @quiet
  end
end

#info(msg) ⇒ Object

Write an information message to the log. Also write to the console unless quiet.



18
19
20
21
# File 'lib/gloo/app/log.rb', line 18

def info( msg )
  @logger.info msg
  puts msg.blue unless @quiet
end

#warn(msg) ⇒ Object

Write a warning message to the log. Also write to the console unless quiet.



27
28
29
30
# File 'lib/gloo/app/log.rb', line 27

def warn( msg )
  @logger.warn msg
  puts msg.yellow unless @quiet
end