module LogSanity
Receives a variety of objects for logging. LogSanity
itself sends Hashes which are formatted with to_json. Other than Strings, will embed any other object into a jsonified hash. Strings are a bit of a special case and by default continue to be formatted with whatever Rails' formatter originally was. As such, it can be configured using `config.log_formatter`. This keeps exception backtraces and other various logs still as Strings. If you prefer Strings to also be turned into jsonified messages, set `config.logsanity.json_strings = true`.
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.
Constants
- VERSION
Public Instance Methods
# File lib/log_sanity.rb, line 25 def fields Thread.current[:logsanity_fields] || reset_fields end
# File lib/log_sanity.rb, line 33 def log(key, val) fields[key.to_s] = val end
# File lib/log_sanity.rb, line 29 def reset_fields Thread.current[:logsanity_fields] = {}.with_indifferent_access end