Module: Plok::Loggable

Extended by:
ActiveSupport::Concern
Included in:
QueuedTask
Defined in:
app/models/concerns/plok/loggable.rb

Instance Method Summary collapse

Instance Method Details

#log(message, category = nil, data = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/models/concerns/plok/loggable.rb', line 8

def log(message, category = nil, data = {})
  data = data.permit!.to_h if data.is_a?(ActionController::Parameters)

  logs.create!(
    content: message,
    category: category,
    data: data
  )
end