Skip to content

hiveer/custom_log_generator

Repository files navigation

CustomLogGenerator

Sometimes, I want more logs to show me the process or some important informations generated by our application. I tried to use default Logger to generate logs in default Rails logs. Then, you would be tired of finding your log in the massive default log file Even though you can use tools like Logentries, but you may still think it's not convinent. B/C we may want to report the logs to someone by email. If you're suffering from what I said above, I think "custom_log_generator" is the gem you want. You can define as many log files as you like in config file. Then, for each file it will generate a custom logger for you. For details, please refer to #usage part.

Installation

This gem can only be used by combining with Rails project.

Add this line to your application's Gemfile:

gem 'custom_log_generator'

And then execute:

$ bundle

Usage

After you finished the installation by bundle. You need to run:

$ rake custom_log:install

After doing this, you will get two file:

  • config/custom_logs.yml
  • config/initializers/generate_custom_logger.rb

Then, you need to declare the logs you want in the config file "custom_logs.yml"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/custom_log_generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

Code of Conduct

Everyone interacting in the CustomLogGenerator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Generate custom Rails logger

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published