Class: Tap::Middlewares::Debugger
- Inherits:
-
Tap::Middleware
- Object
- App::Api
- Tap::Middleware
- Tap::Middlewares::Debugger
- Defined in:
- lib/tap/middlewares/debugger.rb
Overview
:startdoc::middleware default debugger
Logs the execution of tasks with their inputs. Debugger outputs the same information as App.exe will output when the app is set to debug. To avoid duplication, debugger ONLY logs execution when the app is not in debug mode, or when force is set.
Instance Attribute Summary
Attributes inherited from Tap::Middleware
Attributes inherited from App::Api
Instance Method Summary collapse
Methods inherited from Tap::Middleware
Methods inherited from App::Api
#associations, build, help, inherited, #initialize, #inspect, parse, parse!, parser, #to_spec
Methods included from Signals
#sig, #signal, #signal?, #signals
Methods included from Signals::ModuleMethods
Constructor Details
This class inherits a constructor from Tap::Middleware
Instance Method Details
#call(task, input) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/tap/middlewares/debugger.rb', line 16 def call(task, input) log("#{app.var(task)} <<", "#{summarize input} (#{task.class})") output = super log("#{app.var(task)} >>", "#{summarize output} (#{task.class})") output end |
#log(action, msg) ⇒ Object
24 25 26 27 28 |
# File 'lib/tap/middlewares/debugger.rb', line 24 def log(action, msg) if force || !app.debug app.log(action, msg) end end |
#summarize(obj) ⇒ Object
30 31 32 |
# File 'lib/tap/middlewares/debugger.rb', line 30 def summarize(obj) obj.inspect end |