class QPush::Server::Log

The Log is a simple wrapper for the Logger. It outputs log info in a defined manner to the console.

Public Class Methods

new() click to toggle source
# File lib/qpush/server/logger.rb, line 15
def initialize
  @log = ::Logger.new(STDOUT)
  @log.formatter = proc do |_severity, _datetime, _progname, msg|
    "#{msg}\n"
  end
end

Public Instance Methods

err(msg, action: :no_exit) click to toggle source

Creates a new error log message.

# File lib/qpush/server/logger.rb, line 30
def err(msg, action: :no_exit)
  @log.info("[ \e[31mER\e[0m ] #{msg}")
  exit 1 if action == :exit
end
info(msg) click to toggle source

Creates a new info log message.

# File lib/qpush/server/logger.rb, line 24
def info(msg)
  @log.info("[ \e[32mOK\e[0m ] #{msg}")
end