Class: SMPTool::CLI::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/smp_tool/cli/logger.rb

Overview

Simple logger.

Instance Method Summary collapse

Constructor Details

#initialize(level: "brief") ⇒ Logger

Returns a new instance of Logger.



21
22
23
# File 'lib/smp_tool/cli/logger.rb', line 21

def initialize(level: "brief")
  @level = _choose_level(level)
end

Instance Method Details

#debug(msg) ⇒ Object

Debug message.



46
47
48
# File 'lib/smp_tool/cli/logger.rb', line 46

def debug(msg)
  _print_msg(msg, "Debug", DEBUG_MODE) { |s| puts s }
end

#error(msg) ⇒ Object

Error.



41
42
43
# File 'lib/smp_tool/cli/logger.rb', line 41

def error(msg)
  _print_msg(msg, "Error", QUIET_MODE) { |s| warn s }
end

#es_info(msg) ⇒ Object

Essential info.



31
32
33
# File 'lib/smp_tool/cli/logger.rb', line 31

def es_info(msg)
  _print_msg(msg, "Info", BRIEF_MODE) { |s| puts s }
end

#info(msg) ⇒ Object

Low-priority info.



26
27
28
# File 'lib/smp_tool/cli/logger.rb', line 26

def info(msg)
  _print_msg(msg, "Info", VERBOSE_MODE) { |s| puts s }
end

#warning(msg) ⇒ Object

Warning.



36
37
38
# File 'lib/smp_tool/cli/logger.rb', line 36

def warning(msg)
  _print_msg(msg, "Warn", QUIET_MODE) { |s| warn s }
end