Rails::Pretty::Logger
Pretty Logger is a logging framework which can be checked from webpage, and also you can also debug easily with highlight method. You can also override logger class woth Pretty logger so you can keep hourly logs, which can be limited as you wish.
Usage
visit http://your-webpage/rails-pretty-logger/dashboards/ then choose your environment, which you want to check and also you can set date range for narrowing down your logs.
How to use debug Highlighter
PrettyLogger.highlight("lorem ipsum")
Use Hourly Log Rotation
Add these lines below to environment config file which you want to override its logger, first argument for name of the log file, second argument for keeping hourly logs, file count for limiting the logs files.
Rails::Pretty::Logger::ConsoleLogger.new("rails-pretty-logger", "hourly", file_count: 48)
#/config/environments/development.rb
require "rails/pretty/logger/config/logger_config"
logger_file = ActiveSupport::TaggedLogging.new(Rails::Pretty::Logger::ConsoleLogger.new("rails-pretty-logger", "hourly", file_count: 48))
config.logger = logger_file
Installation
Add this line to your application's Gemfile:
gem 'rails-pretty-logger'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails-pretty-logger
Mount the engine in your config/routes.rb:
mount Rails::Pretty::Logger::Engine => "/rails-pretty-logger"
Contributing
- Fork the official repository.
- Create a topic branch.
- Implement your feature or bug fix.
- Add, commit, and push your changes.
- Submit a pull request.
License
The gem is available as open source under the terms of the MIT License.