Class: Taskr::Controllers::LogEntries

Inherits:
REST
  • Object
show all
Defined in:
lib/taskr/controllers.rb

Instance Method Summary collapse

Instance Method Details

#listObject



324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/taskr/controllers.rb', line 324

def list
  @since = @input[:since]
  
  @level = ['DEBUG', 'INFO', 'WARN', 'ERROR']
  @level.index(@input[:level]).times {@level.shift} if @input[:level]
  
  @log_entries = LogEntry.find(:all, 
    :conditions => ['task_id = ? AND IF(?,timestamp > ?,1) AND level IN (?)', 
                    @input[:task_id], !@since.blank?, @since, @level],
    :order => 'timestamp DESC, id DESC')
  
  render :log_entries_list
end