Class: Lazylead::ORM::VerboseTask
- Inherits:
-
Object
- Object
- Lazylead::ORM::VerboseTask
- Extended by:
- Forwardable
- Defined in:
- lib/lazylead/model.rb
Overview
A task with extended logging
Instance Method Summary collapse
-
#exec ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(orig, log = Log.new) ⇒ VerboseTask
constructor
A new instance of VerboseTask.
Constructor Details
#initialize(orig, log = Log.new) ⇒ VerboseTask
Returns a new instance of VerboseTask.
180 181 182 183 |
# File 'lib/lazylead/model.rb', line 180 def initialize(orig, log = Log.new) @orig = orig @log = log end |
Instance Method Details
#exec ⇒ Object
TODO:
#/DEV Remove the suppression during next refactoring (or enhancements) for the method below
rubocop:disable Metrics/AbcSize
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/lazylead/model.rb', line 189 def exec Logging.mdc["tid"] = "task #{id}" @log.debug "'#{name}' is started." @log.warn "No postman, stub is used." unless props.key? "postman" @log.warn "No team." if team.nil? @orig.exec @log.debug "'#{name}' is completed" rescue StandardError => e msg = <<~MSG ll-006: Task ##{id} #{e} (#{e.class}) at #{self} #{Backtrace.new(e) if ARGV.include? '--trace'} MSG @log.error msg ensure Logging.mdc["tid"] = "" end |