Class: ActiveHook::Log
- Inherits:
-
Object
- Object
- ActiveHook::Log
- Defined in:
- lib/activehook/log.rb
Instance Method Summary collapse
- #err(msg, action: :no_exit) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize ⇒ Log
Returns a new instance of Log.
13 14 15 16 17 18 |
# File 'lib/activehook/log.rb', line 13 def initialize @log = ::Logger.new(STDOUT) @log.formatter = proc do |_severity, datetime, _progname, msg| "#{msg}\n" end end |
Instance Method Details
#err(msg, action: :no_exit) ⇒ Object
24 25 26 27 |
# File 'lib/activehook/log.rb', line 24 def err(msg, action: :no_exit) @log.info("[ \e[31mER\e[0m ] #{msg}") exit 1 if action == :exit end |
#info(msg) ⇒ Object
20 21 22 |
# File 'lib/activehook/log.rb', line 20 def info(msg) @log.info("[ \e[32mOK\e[0m ] #{msg}") end |