README.md in log_sweeper-1.0.0 vs README.md in log_sweeper-1.1.0

- old
+ new

@@ -1,39 +1,42 @@ -# LogSweeper +# LogSweeper   [![Gem Version](https://badge.fury.io/rb/log_sweeper.svg)](https://badge.fury.io/rb/log_sweeper) [![Build Status](https://travis-ci.org/umbrellio/log_sweeper.svg?branch=master)](https://travis-ci.org/umbrellio/log_sweeper) [![Coverage Status](https://coveralls.io/repos/github/umbrellio/log_sweeper/badge.svg?branch=master)](https://coveralls.io/github/umbrellio/log_sweeper?branch=master) -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/log_sweeper`. To experiment with that code, run `bin/console` for an interactive prompt. +`LogSweeper` is a simple module for cleaning up log directories. -TODO: Delete this and the text above, and describe your gem +It is designed to be used with Ruby logger rotation. By default, it will remove all log files older than 10 days and will gzip all log files that look like rotated log files. For example, `production.log.20190228` will be gzipped and replaced with `production.log.20190228.gz`. It logs what it's doing using the provided logger which defaults to `STDOUT` logger. ## Installation -Add this line to your application's Gemfile: +Juts add `gem "log_sweeper"` to your Gemfile. +## Examples + ```ruby -gem 'log_sweeper' -``` + # Just use the defaults + LogSweeper.run("log") -And then execute: + # Customize logs lifetime and logger + LogSweeper.run("log", logs_lifetime_days_count: 5, logger: Logger.new("/path/to/file.log")) - $ bundle + # In case you don't want any logging and deleting any logs + LogSweeper.run("log", logs_lifetime_days_count: Float::INFINITY, logger: Logger.new(nil)) +``` -Or install it yourself as: +The best way to use this module is to run it via cron, for example you can use [whenever](https://github.com/javan/whenever) gem with similar config in `schedule.rb` file: - $ gem install log_sweeper +```ruby +every 1.hour do + runner "LogRotator.run(Rails.root.join('log'))" +end +``` -## Usage +## License -TODO: Write usage instructions here +Released under MIT License. -## Development +## Authors -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. +Created by Yuri Smirnov. -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](https://rubygems.org). - -## Contributing - -Bug reports and pull requests are welcome on GitHub at https://github.com/tycooon/log_sweeper. - -## License - -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). +<a href="https://github.com/umbrellio/"> +<img style="float: left;" src="https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg" alt="Supported by Umbrellio" width="439" height="72"> +</a>