Sha256: ead77e38e17b884273203750d2f81ab72a92ef2646c45f7a87cb4a250a4eb0c3

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

%w(
  formatter
  railtie
  log_subscribers/base
  log_subscribers/action_cable
  log_subscribers/action_controller
  log_subscribers/action_dispatch
  log_subscribers/action_mailer
  log_subscribers/active_job
  middleware/request_logger
  extensions/action_cable_connection
  extensions/action_controller_helper
).each do |fn|
  require_relative "log_sanity/#{fn}"
end

module LogSanity
  module_function

  def fields
    # this is fiber-local
    Thread.current[:logsanity_fields] || reset_fields
  end

  def reset_fields
    Thread.current[:logsanity_fields] = {}.with_indifferent_access
  end

  def log(key, val)
    fields[key.to_s] = val
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
log_sanity-2.3.0 lib/log_sanity.rb
log_sanity-2.2.0 lib/log_sanity.rb
log_sanity-2.1.2 lib/log_sanity.rb
log_sanity-2.1.1 lib/log_sanity.rb
log_sanity-2.1.0 lib/log_sanity.rb