Class: Tracing::StreamAppender
- Inherits:
-
BaseAppender
- Object
- BaseAppender
- Tracing::StreamAppender
- Defined in:
- lib/appenders/types/stream_appender.rb
Instance Attribute Summary collapse
-
#stream ⇒ Object
Returns the value of attribute stream.
Attributes inherited from BaseAppender
Attributes included from FilterUse
Attributes included from Filter::ExecUse
Attributes included from Filter::Registration
Instance Method Summary collapse
-
#allow_append(txt, context) ⇒ Object
perform append.
- #configure_stream(options) ⇒ Object
-
#initialize(init_options) ⇒ StreamAppender
constructor
A new instance of StreamAppender.
-
#not_allow_append(lines, context) ⇒ Object
silently ignore.
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) ⇒ StreamAppender
15 16 17 18 19 |
# File 'lib/appenders/types/stream_appender.rb', line 15 def initialize() @tracer = Tracing::OutputTemplate::StringTrace.new super() configure_stream() end |
Instance Attribute Details
#stream ⇒ Object
Returns the value of attribute stream.
3 4 5 |
# File 'lib/appenders/types/stream_appender.rb', line 3 def stream @stream end |
Instance Method Details
#allow_append(txt, context) ⇒ Object
perform append
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/appenders/types/stream_appender.rb', line 22 def allow_append(txt, context) # check if BEGIN or END if txt.include?('BEGIN') txt = tracer.handle_before_call(context) elsif txt.include?('END') txt = tracer.handle_after_call(context) end stream.puts txt end |
#configure_stream(options) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/appenders/types/stream_appender.rb', line 5 def configure_stream() @stream = $stdout if case [:stream] when :error @stream = $stderr end end end |
#not_allow_append(lines, context) ⇒ Object
silently ignore
34 35 |
# File 'lib/appenders/types/stream_appender.rb', line 34 def not_allow_append(lines, context) end |