Class: Tracing::ActionHandler

Inherits:
Object
  • Object
show all
Includes:
Tracing::Appender::Registration, FilterUse
Defined in:
lib/action_handler/action_handler.rb,
lib/action_handler/action_handler_registration.rb

Defined Under Namespace

Modules: Registration

Instance Attribute Summary

Attributes included from Tracing::Appender::Registration

#appenders

Attributes included from FilterUse

#filters

Attributes included from Filter::ExecUse

#filter_executor

Attributes included from Filter::Registration

#filters

Instance Method Summary collapse

Methods included from Tracing::Appender::Registration

#register_appenders

Methods included from Filter::Registration

#_register_filters, #create_filters, #register_filters, #unregister_filters

Constructor Details

#initialize(init_options) ⇒ ActionHandler

register filters and appenders



12
13
14
15
# File 'lib/action_handler/action_handler.rb', line 12

def initialize(init_options)
  register_filters(init_options.filters)
  register_appenders(init_options.appenders)
end

Instance Method Details

#handle(txt, context) ⇒ Object

handle tracelogs by applying filters and action handler methods



30
31
32
33
34
35
36
37
38
# File 'lib/action_handler/action_handler.rb', line 30

def handle(txt, context)
  if filters_allow?(txt, context)
    # puts "handle_allow: " + context[:method_name]
    handle_allow(txt, context)
  else
    # puts "handle_not_allow: " + context[:method_name]        
    handle_not_allow(txt, context)
  end
end

#handle_allow(txt, context) ⇒ Object

action for tracelogs that pass the filters by default send to all appenders for further processing!



19
20
21
22
23
# File 'lib/action_handler/action_handler.rb', line 19

def handle_allow(txt, context)
  appenders.each do |appender|
    appender.handle(txt, context)
  end
end

#handle_not_allow(txt, context) ⇒ Object

action for tracelogs that DO NOT pass the filters



26
27
# File 'lib/action_handler/action_handler.rb', line 26

def handle_not_allow(txt, context)
end