Sha256: 898d9d6c502c59c6be0deb7b05ff59b561555fb3e66368206d2b0dbd86584d79

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 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
    middleware/routing_error_catcher
    extensions/action_cable_connection
    extensions/action_controller_helper
    extensions/active_support_subscriber
  ).each do |fn|
  require_relative "log_sanity/#{fn}"
end

if Rails.version < '6'
  ActiveSupport::Subscriber.include LogSanity::Extensions::ActiveSupportSubscriber
end

module LogSanity
  module_function

  def fields
    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

3 entries across 3 versions & 1 rubygems

Version Path
log_sanity-1.3.2 lib/log_sanity.rb
log_sanity-1.3.1 lib/log_sanity.rb
log_sanity-1.3.0 lib/log_sanity.rb