Class: SemanticLogger::Processor
- Inherits:
-
Appender::Async
- Object
- Appender::Async
- SemanticLogger::Processor
- Defined in:
- lib/semantic_logger/processor.rb
Overview
Thread that submits and processes log requests
Class Attribute Summary collapse
-
.logger ⇒ Object
Internal logger for SemanticLogger For example when an appender is not working etc..
Instance Attribute Summary collapse
-
#appenders ⇒ Object
readonly
Returns the value of attribute appenders.
Attributes inherited from Appender::Async
#appender, #lag_check_interval, #lag_threshold_s, #max_queue_size, #queue
Instance Method Summary collapse
-
#initialize(max_queue_size: -1)) ⇒ Processor
constructor
A new instance of Processor.
-
#start ⇒ Object
Start the appender thread.
Methods inherited from Appender::Async
#active?, #capped?, #close, #flush, #log, #reopen, #thread
Constructor Details
#initialize(max_queue_size: -1)) ⇒ Processor
Returns a new instance of Processor.
26 27 28 29 |
# File 'lib/semantic_logger/processor.rb', line 26 def initialize(max_queue_size: -1) @appenders = Appenders.new(self.class.logger.dup) super(appender: @appenders, max_queue_size: max_queue_size) end |
Class Attribute Details
.logger ⇒ Object
Internal logger for SemanticLogger
For example when an appender is not working etc..
By default logs to $stderr
15 16 17 18 19 20 21 22 |
# File 'lib/semantic_logger/processor.rb', line 15 def self.logger @logger ||= begin l = SemanticLogger::Appender::IO.new($stderr, level: :warn) l.name = name l end end |
Instance Attribute Details
#appenders ⇒ Object (readonly)
Returns the value of attribute appenders.
24 25 26 |
# File 'lib/semantic_logger/processor.rb', line 24 def appenders @appenders end |
Instance Method Details
#start ⇒ Object
Start the appender thread
32 33 34 35 36 37 |
# File 'lib/semantic_logger/processor.rb', line 32 def start return false if active? thread true end |