Class: Camo::Logger
- Inherits:
-
Object
- Object
- Camo::Logger
- Defined in:
- lib/camo/logger.rb
Constant Summary collapse
- LOG_LEVELS =
["debug", "info", "error", "fatal"].freeze
- LOG_LEVEL =
(LOG_LEVELS.find { |level| level == ENV["CAMORB_LOG_LEVEL"] } || "info").freeze
Instance Attribute Summary collapse
-
#errpipe ⇒ Object
readonly
Returns the value of attribute errpipe.
-
#outpipe ⇒ Object
readonly
Returns the value of attribute outpipe.
Class Method Summary collapse
Instance Method Summary collapse
- #debug(msg, params = {}) ⇒ Object
- #error(msg, params = {}) ⇒ Object
- #info(msg, params = {}) ⇒ Object
-
#initialize(outpipe, errpipe) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize(outpipe, errpipe) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 |
# File 'lib/camo/logger.rb', line 8 def initialize(outpipe, errpipe) @outpipe = outpipe @errpipe = errpipe end |
Instance Attribute Details
#errpipe ⇒ Object (readonly)
Returns the value of attribute errpipe.
3 4 5 |
# File 'lib/camo/logger.rb', line 3 def errpipe @errpipe end |
#outpipe ⇒ Object (readonly)
Returns the value of attribute outpipe.
3 4 5 |
# File 'lib/camo/logger.rb', line 3 def outpipe @outpipe end |
Class Method Details
.stdio ⇒ Object
13 14 15 |
# File 'lib/camo/logger.rb', line 13 def self.stdio new $stdout, $stderr end |
Instance Method Details
#debug(msg, params = {}) ⇒ Object
17 18 19 |
# File 'lib/camo/logger.rb', line 17 def debug(msg, params = {}) outpipe.puts(compile_output("debug", msg, params)) if debug? end |
#error(msg, params = {}) ⇒ Object
25 26 27 |
# File 'lib/camo/logger.rb', line 25 def error(msg, params = {}) errpipe.puts(compile_output("error", msg, params)) if error? end |
#info(msg, params = {}) ⇒ Object
21 22 23 |
# File 'lib/camo/logger.rb', line 21 def info(msg, params = {}) outpipe.puts(compile_output("info", msg, params)) if info? end |