class Taskflow::Logger

Public Instance Methods

debug(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 43
def debug(content,options={})
    options.merge!(:level=>'DEBUG')
    self.log content,options
end
error(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 28
def error(content,options={})
    options.merge!(:level=>'ERROR')
    self.log content,options
end
fatal(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 33
def fatal(content,options={})
    options.merge!(:level=>'FATAL')
    self.log content,options
end
info(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 23
def info(content,options={})
    options.merge!(:level=>'INFO')
    self.log content,options
end
log(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 8
def log(content,options={})
    raise 'Need step id to write a log' if options[:step_id].nil? && @step_id.nil?
    options[:step_id] ||= @step_id
    options[:writer] ||= @writer
    @step_id ||= options[:step_id]
    @writer ||= options[:writer]
    options.merge! :content=>content
    record = self.records.last
    if record && options.all?{|k,v| record.send(k) == v }
        record.update_attributes! written_at: Time.now
    else
        self.records.create options
    end
end
warning(content,options={}) click to toggle source
# File lib/taskflow/logger.rb, line 38
def warning(content,options={})
    options.merge!(:level=>'WARNING')
    self.log content,options
end

Private Instance Methods

set_default_property() click to toggle source
# File lib/taskflow/logger.rb, line 49
def set_default_property
    self.created_at ||= Time.now
end