Module: LogStruct::LoggedErrors

Extended by:
T::Sig
Defined in:
lib/log_struct/logged_errors.rb

Overview

Exceptions LogStruct has already logged as a structured line, so an integration that sees the same exception again doesn't log it twice. GoodJob passes a failed job's exception to on_thread_error after the ActiveJob integration has logged it, for example. Exceptions are held weakly, so a mark doesn't keep one alive.

Class Method Summary collapse

Class Method Details

.logged?(error) ⇒ Boolean

Parameters:

  • error (Exception)

Returns:

  • (Boolean)


21
22
23
# File 'lib/log_struct/logged_errors.rb', line 21

def self.logged?(error)
  @mutex.synchronize { @logged.key?(error) }
end

.mark(error) ⇒ void

This method returns an undefined value.

Parameters:

  • error (Exception)


16
17
18
# File 'lib/log_struct/logged_errors.rb', line 16

def self.mark(error)
  @mutex.synchronize { @logged[error] = true }
end