Low commit activity in last 3 years
No release in over a year
An enhanced logger for Roda applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 3.19.0
>= 0.3, < 1.0
 Project Readme

Roda Enhanced Logger

A powerful logger for Roda with a few tricks up it's sleeve.

  • Coloured output per level
  • Structured output of query params
  • Tracking of database query time and count
  • Tracking of blocks which handle path segment
  • Tracing missed requests
  • Tracing all requests

Enhanced Logger Output

Installation

Add this line to your application's Gemfile:

gem "roda-enhanced_logger"

And then execute:

$ bundle

Or install it yourself as:

$ gem install roda-enhanced_logger

Usage

For basic usage, simply enable through the plugin mechanism.

class App < Roda
  plugin :enhanced_logger
end

If you serve assets through Roda, your logs might be fairly noisy, so you can filter them.

plugin :enhanced_logger, filter: ->(path) { path.start_with?("/assets") }

By default, EnhancedLogger will attempt to filter passwords and CSRF tokens, but you can filter other fields too.

plugin :enhanced_logger, filtered_params: %w[api_key]

If there's a DB constant defined for Sequel, EnhancedLogger will automatically use it, but you can pass in a custom value if necessary.

plugin :enhanced_logger, db: Container[:db]

During development, a 404 might catch you off guard for a path that you feel should exist, so it's handy to trace missed routes to aide in debugging.

plugin :enhanced_logger, trace_missed: true

Or always trace every request.

plugin :enhanced_logger, trace_all: true

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/adam12/roda-enhanced_logger.

I love pull requests! If you fork this project and modify it, please ping me to see if your changes can be incorporated back into this project.

That said, if your feature idea is nontrivial, you should probably open an issue to discuss it before attempting a pull request.

License

The gem is available as open source under the terms of the MIT License.