Module: LogSanity

Defined in:
lib/log_sanity/formatter.rb,
lib/log_sanity/railtie.rb,
lib/log_sanity/version.rb,
lib/log_sanity/log_subscribers/base.rb,
lib/log_sanity/middleware/request_logger.rb,
lib/log_sanity/log_subscribers/active_job.rb,
lib/log_sanity/log_subscribers/action_cable.rb,
lib/log_sanity/log_subscribers/action_mailer.rb,
lib/log_sanity/log_subscribers/action_dispatch.rb,
lib/log_sanity/middleware/routing_error_catcher.rb,
lib/log_sanity/log_subscribers/action_controller.rb,
lib/log_sanity/extensions/action_cable_connection.rb,
lib/log_sanity/extensions/action_controller_helper.rb,
lib/log_sanity/extensions/active_support_subscriber.rb,
lib/log_sanity.rb

Overview

middleware to catch and sanely handle routing errors without treating them like all other exceptions (that is, without verbose backtraces and other such). intended to be added to the end of the middleware stack (nearest the app). while built on top of ShowExceptions to reuse its error rendering logic, does not replace it.

Defined Under Namespace

Modules: Extensions, LogSubscriber Classes: Formatter, Railtie, RequestLogger, RoutingErrorCatcher

Constant Summary collapse

VERSION =
'1.3.2'

Class Method Summary collapse

Class Method Details

.fieldsObject



25
26
27
# File 'lib/log_sanity.rb', line 25

def fields
  Thread.current[:logsanity_fields] || reset_fields
end

.log(key, val) ⇒ Object



33
34
35
# File 'lib/log_sanity.rb', line 33

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

.reset_fieldsObject



29
30
31
# File 'lib/log_sanity.rb', line 29

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