Class: AbideDataProcessor::Processor::Logger
- Inherits:
-
Object
- Object
- AbideDataProcessor::Processor::Logger
- Defined in:
- lib/abide-data-processor/logger.rb
Constant Summary collapse
- LEVELS =
{error: 1, warning: 2, info: 3, debug: 4}
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #err(message) ⇒ Object
- #inform(message) ⇒ Object
-
#initialize(level = :info, out = STDOUT, err = STDERR) ⇒ Logger
constructor
A new instance of Logger.
- #warn(message) ⇒ Object
Constructor Details
#initialize(level = :info, out = STDOUT, err = STDERR) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 12 13 14 15 16 |
# File 'lib/abide-data-processor/logger.rb', line 8 def initialize(level = :info, out = STDOUT, err = STDERR) @level = LEVELS[level] if @level.nil? raise ArgumentError, "Unknown log level at #{level}" end @out = out @err = err end |
Instance Method Details
#debug(message) ⇒ Object
18 19 20 21 22 |
# File 'lib/abide-data-processor/logger.rb', line 18 def debug() if @level >= LEVELS[:debug] @out.puts() end end |
#err(message) ⇒ Object
36 37 38 39 40 |
# File 'lib/abide-data-processor/logger.rb', line 36 def err() if @level >= LEVELS[:error] @err.puts() end end |
#inform(message) ⇒ Object
24 25 26 27 28 |
# File 'lib/abide-data-processor/logger.rb', line 24 def inform() if @level >= LEVELS[:info] @out.puts() end end |
#warn(message) ⇒ Object
30 31 32 33 34 |
# File 'lib/abide-data-processor/logger.rb', line 30 def warn() if @level >= LEVELS[:warning] @out.puts() end end |