Class: Interceptors::LoggingInterceptor
- Inherits:
-
Interceptor
- Object
- Interceptor
- Interceptors::LoggingInterceptor
- Defined in:
- lib/interceptors/logging_interceptor.rb
Instance Method Summary collapse
- #after(_ctx, result) ⇒ Object
- #before(ctx) ⇒ Object
-
#initialize(logger: nil) ⇒ LoggingInterceptor
constructor
A new instance of LoggingInterceptor.
Methods inherited from Interceptor
Constructor Details
#initialize(logger: nil) ⇒ LoggingInterceptor
Returns a new instance of LoggingInterceptor.
5 6 7 |
# File 'lib/interceptors/logging_interceptor.rb', line 5 def initialize(logger: nil) @logger = logger end |
Instance Method Details
#after(_ctx, result) ⇒ Object
13 14 15 16 |
# File 'lib/interceptors/logging_interceptor.rb', line 13 def after(_ctx, result) log(:after, ok: result.ok?, error: result.error&.) result end |
#before(ctx) ⇒ Object
9 10 11 |
# File 'lib/interceptors/logging_interceptor.rb', line 9 def before(ctx) log(:before, ctx: ctx) end |