Class: Ephemeron::Logger

Inherits:
ThreadStore
  • Object
show all
Defined in:
lib/ephemeron/logger/convert.rb,
lib/ephemeron/logger/finders.rb,
lib/ephemeron/writers/logger.rb

Defined Under Namespace

Modules: Convert, Finders

Constant Summary collapse

PROXY_EVENTS =
%i[proxy_start proxy_end].freeze
VALID_EVENTS =
%i[fetched fetch_allowed saved save_allowed skip_save used] + PROXY_EVENTS

Instance Method Summary collapse

Instance Method Details

#has?(model, event) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/ephemeron/writers/logger.rb', line 14

def has?(model, event)
  validate model, event
  logs.include? Convert.call(model, event)
end

#log(model, event, opts = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/ephemeron/writers/logger.rb', line 19

def log(model, event, opts = {})
  validate model, event
  logs << Convert.call(model, event)
rescue LoggerError, StoreError => e
  raise e unless opts[:soft]
end

#logsObject



10
11
12
# File 'lib/ephemeron/writers/logger.rb', line 10

def logs
  self.ts_logs ||= []
end

#resetObject



26
27
28
# File 'lib/ephemeron/writers/logger.rb', line 26

def reset
  self.ts_logs = []
end