Class: Tracing::TemplateLogAppender

Inherits:
FileAppender show all
Defined in:
lib/appenders/types/template_log_appender.rb

Instance Attribute Summary

Attributes inherited from BaseAppender

#options, #templates

Attributes included from FilterUse

#filters

Attributes included from Filter::ExecUse

#filter_executor

Attributes included from Filter::Registration

#filters

Instance Method Summary collapse

Methods inherited from FileAppender

#create_initial_file, #file_path, #insert_into_file, #is_old_file?, #write_file

Methods included from DefaultPath

#default_path, #default_path=

Methods inherited from BaseAppender

create_template, #handle, register_templates, #time_limit

Methods included from Filter::Registration

#_register_filters, #create_filters, #register_filters, #unregister_filters

Constructor Details

#initialize(init_options) ⇒ TemplateLogAppender

Returns a new instance of TemplateLogAppender.



4
5
6
7
# File 'lib/appenders/types/template_log_appender.rb', line 4

def initialize(init_options)
  @tracer = Tracing::OutputTemplate::StringTrace.new
  super(init_options)
end

Instance Method Details

#allow_append(lines, context) ⇒ Object

perform append



16
17
18
19
20
21
22
# File 'lib/appenders/types/template_log_appender.rb', line 16

def allow_append(lines, context)
  path = template_path(context)
  if path
    log_file =  + '.log'
    write_file(log_file)
  end
end

#not_allow_append(lines, context) ⇒ Object

silently ignore



25
26
# File 'lib/appenders/types/template_log_appender.rb', line 25

def not_allow_append(lines, context)
end

#template_path(context) ⇒ Object

get template path



10
11
12
13
# File 'lib/appenders/types/template_log_appender.rb', line 10

def template_path(context)
  obj = context[:self]
  template_path = obj.instance_variable_get :@template_path    
end