Module: NCore::ControllerRuntime::ClassMethods

Defined in:
lib/ncore/rails/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#log_process_action(payload) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/ncore/rails/log_subscriber.rb', line 105

def log_process_action(payload)
  messages, rt_set = super, payload[:api_runtime]
  rt_set.each do |title, rt|
    messages << ("#{title}: %.1fms" % rt.to_f) if rt && rt > 0
  end if rt_set
  messages
end

#register_api_runtime(log_sub, title) ⇒ Object



113
114
115
116
117
# File 'lib/ncore/rails/log_subscriber.rb', line 113

def register_api_runtime(log_sub, title)
  unless ControllerRuntime.api_runtime_list.detect{|arl| arl[:log_sub]==log_sub }
    ControllerRuntime.api_runtime_list += [{log_sub: log_sub, title: title, rt: 0}]
  end
end