Class: ActiveHook::Server::Log
- Inherits:
-
Object
- Object
- ActiveHook::Server::Log
- Defined in:
- lib/activehook/server/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.
14 15 16 17 18 19 |
# File 'lib/activehook/server/log.rb', line 14 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
25 26 27 28 |
# File 'lib/activehook/server/log.rb', line 25 def err(msg, action: :no_exit) @log.info("[ \e[31mER\e[0m ] #{msg}") exit 1 if action == :exit end |
#info(msg) ⇒ Object
21 22 23 |
# File 'lib/activehook/server/log.rb', line 21 def info(msg) @log.info("[ \e[32mOK\e[0m ] #{msg}") end |