Class: Holistics::CustomLogger
- Inherits:
-
Object
- Object
- Holistics::CustomLogger
- Defined in:
- lib/holistics/custom_logger.rb
Instance Method Summary collapse
- #debug(data, options = {}) ⇒ Object
- #error(data, options = {}) ⇒ Object
- #info(data, options = {}) ⇒ Object
-
#initialize(out) ⇒ CustomLogger
constructor
A new instance of CustomLogger.
- #log(level, data, options = {}) ⇒ Object
- #warn(data, options = {}) ⇒ Object
Constructor Details
#initialize(out) ⇒ CustomLogger
Returns a new instance of CustomLogger.
5 6 7 |
# File 'lib/holistics/custom_logger.rb', line 5 def initialize out @out = out end |
Instance Method Details
#debug(data, options = {}) ⇒ Object
18 19 20 |
# File 'lib/holistics/custom_logger.rb', line 18 def debug data, = {} log('debug', data, ) end |
#error(data, options = {}) ⇒ Object
26 27 28 |
# File 'lib/holistics/custom_logger.rb', line 26 def error data, = {} log('error', data, ) end |
#info(data, options = {}) ⇒ Object
14 15 16 |
# File 'lib/holistics/custom_logger.rb', line 14 def info data, = {} log('info', data, ) end |
#log(level, data, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/holistics/custom_logger.rb', line 9 def log(level, data, = {}) t = [:timestamp] || Time.now.utc @out.puts "#{t}; #{level.to_s.upcase}: #{data}" end |
#warn(data, options = {}) ⇒ Object
22 23 24 |
# File 'lib/holistics/custom_logger.rb', line 22 def warn data, = {} log('warn', data, ) end |