Class: Taskr::Models::LogEntry::ActionLogger

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

Overview

Exposes a Logger-like interface for logging entries for some particular TaskAction.

Instance Method Summary collapse

Constructor Details

#initialize(action) ⇒ ActionLogger

Returns a new instance of ActionLogger.



339
340
341
# File 'lib/taskr/models.rb', line 339

def initialize(action)
  @action = action
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, data) ⇒ Object



343
344
345
# File 'lib/taskr/models.rb', line 343

def method_missing(method, data)
  LogEntry.send(method, @action, "#{"#{@progname}: " unless @progname.blank?}#{data}")
end

Instance Method Details

#prognameObject



351
352
353
# File 'lib/taskr/models.rb', line 351

def progname
  action.task.name
end

#progname=(p) ⇒ Object



355
356
# File 'lib/taskr/models.rb', line 355

def progname=(p)
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


347
348
349
# File 'lib/taskr/models.rb', line 347

def respond_to?(method)
  [:debug, :info, :warn, :error].include?(method)
end