Method: Copland::Implementation::LoggingInterceptor#process

Defined in:
lib/copland/impl/logging-interceptor.rb

#process(chain, context) ⇒ Object

Processes a method invocation context. If the current log has debugging activated, and the requested method is not excluded by the interceptor’s exclude and include patterns, then a message will be written for the method’s invocation, its return code, and any exception that is thrown.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/copland/impl/logging-interceptor.rb', line 84

def process( chain, context )
  if @log.debug? && match( context )
    args = context.args.map { |i| i.inspect } .join( ', ' )
    @log.debug "#{context.sym}( #{args} )"

    begin
      result = chain.process_next( context )
    rescue Exception => e
      @log.debug "#{context.sym} raised #{e.message.inspect} (#{e.class})"
      raise
    end

    @log.debug "#{context.sym} => #{result.inspect}"
    return result
  else
    return chain.process_next( context )
  end
end