Class: Taskflow::Logger
- Inherits:
-
Object
- Object
- Taskflow::Logger
- Includes:
- Mongoid::Document
- Defined in:
- lib/taskflow/logger.rb
Instance Method Summary collapse
- #debug(content, options = {}) ⇒ Object
- #error(content, options = {}) ⇒ Object
- #fatal(content, options = {}) ⇒ Object
- #info(content, options = {}) ⇒ Object
- #log(content, options = {}) ⇒ Object
- #warning(content, options = {}) ⇒ Object
Instance Method Details
#debug(content, options = {}) ⇒ Object
46 47 48 49 |
# File 'lib/taskflow/logger.rb', line 46 def debug(content,={}) .merge!(:level=>'DEBUG') self.log content, end |
#error(content, options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/taskflow/logger.rb', line 31 def error(content,={}) .merge!(:level=>'ERROR') self.log content, end |
#fatal(content, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/taskflow/logger.rb', line 36 def fatal(content,={}) .merge!(:level=>'FATAL') self.log content, end |
#info(content, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/taskflow/logger.rb', line 26 def info(content,={}) .merge!(:level=>'INFO') self.log content, end |
#log(content, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/taskflow/logger.rb', line 11 def log(content,={}) raise 'Need step id to write a log' if [:step_id].nil? && @step_id.nil? [:step_id] ||= @step_id [:writer] ||= @writer @step_id ||= [:step_id] @writer ||= [:writer] .merge! :content=>content record = self.records.last if record && .all?{|k,v| record.send(k) == v } record.update_attributes! written_at: Time.now else self.records.create end end |
#warning(content, options = {}) ⇒ Object
41 42 43 44 |
# File 'lib/taskflow/logger.rb', line 41 def warning(content,={}) .merge!(:level=>'WARNING') self.log content, end |