All Projects → adam12 → roda-enhanced_logger

adam12 / roda-enhanced_logger

Licence: MIT license
The Roda logger you've been waiting for

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to roda-enhanced logger

html2rss-web
🕸 Generates and delivers RSS feeds via HTTP. Create your own feeds or get started quickly with the included configs.
Stars: ✭ 36 (+111.76%)
Mutual labels:  roda
spaceholder.cc
A space-themed image placeholder service.
Stars: ✭ 28 (+64.71%)
Mutual labels:  roda
rodauth hanami
Example app for integrate rodauth server to hanami app
Stars: ✭ 16 (-5.88%)
Mutual labels:  roda

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].