Class: LogErrorHandler::Tracker
- Inherits:
-
Object
- Object
- LogErrorHandler::Tracker
- Defined in:
- lib/log_error_handler.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ error_regexp: /500.*error/i, tid_regexp: /^\[\d+\]/, not_modify_timeout: 3, log_file_tracker_waiting: 300, http_method: :post, error_message_key: :message }.freeze
Instance Attribute Summary collapse
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
-
#tracking_logs ⇒ Object
Returns the value of attribute tracking_logs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Tracker
constructor
A new instance of Tracker.
- #start ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Tracker
Returns a new instance of Tracker.
25 26 27 28 29 30 |
# File 'lib/log_error_handler.rb', line 25 def initialize(opts = {}) @tracking_logs = {} @options = DEFAULT_OPTIONS.merge(opts) @out = OutFactory.retrieve(@options) @mutex = Mutex.new end |
Instance Attribute Details
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
14 15 16 |
# File 'lib/log_error_handler.rb', line 14 def mutex @mutex end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/log_error_handler.rb', line 14 def @options end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
14 15 16 |
# File 'lib/log_error_handler.rb', line 14 def out @out end |
#tracking_logs ⇒ Object
Returns the value of attribute tracking_logs.
13 14 15 |
# File 'lib/log_error_handler.rb', line 13 def tracking_logs @tracking_logs end |
Class Method Details
.start(opts = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/log_error_handler.rb', line 32 def self.start(opts = {}) tracker = new(opts) if opts[:log_file] IO.popen("tail -f #{opts[:log_file]}") do |stdin| $stdin = stdin tracker.start end else tracker.start end tracker end |
Instance Method Details
#start ⇒ Object
46 47 48 49 50 51 |
# File 'lib/log_error_handler.rb', line 46 def start @log_file_tracker = LogFileTracker.start(self) StdinReader.start(self) ensure close_all_files end |