Class: Catlass::Logger
- Inherits:
-
Logger
- Object
- Logger
- Catlass::Logger
- Includes:
- Singleton
- Defined in:
- lib/catlass/logger.rb
Defined Under Namespace
Modules: Helper
Instance Method Summary collapse
- #debug(progname = nil, method_name = nil, msg) ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #warn(msg) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
35 36 37 38 39 40 41 42 43 |
# File 'lib/catlass/logger.rb', line 35 def initialize super(STDERR) self.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end self.level = Logger::INFO end |
Instance Method Details
#debug(progname = nil, method_name = nil, msg) ⇒ Object
45 46 47 |
# File 'lib/catlass/logger.rb', line 45 def debug(progname = nil, method_name = nil, msg) super(progname) { { method_name: method_name, message: msg } } end |
#error(msg) ⇒ Object
61 62 63 |
# File 'lib/catlass/logger.rb', line 61 def error(msg) super { Catlass::TermColor.red(msg) } end |
#fatal(msg) ⇒ Object
57 58 59 |
# File 'lib/catlass/logger.rb', line 57 def fatal(msg) super { Catlass::TermColor.red(msg) } end |
#info(msg) ⇒ Object
49 50 51 |
# File 'lib/catlass/logger.rb', line 49 def info(msg) super { Catlass::TermColor.green(msg) } end |
#warn(msg) ⇒ Object
53 54 55 |
# File 'lib/catlass/logger.rb', line 53 def warn(msg) super { Catlass::TermColor.yellow(msg) } end |