ExtBatch
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/ext_batch
. To experiment with that code, run bin/console
for an interactive prompt.
Extended the ext_logger gem package, services for Ruby batch and Ruby rake.
Other extensions see version updates.
2019-01-20(0.1.0):
dependency: ext_logger ~> v0.2
Installation
Add this line to your application's Gemfile:
gem 'ext_batch'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ext_batch
Usage
- Initialization object (It automatically creates non-existent directories based on paths):
batch = ExtBatch.new(task_name, {log: {age: 7/'weekly', size: 1024000, split_format: '%Y%m%d%H%M', log_max_num: 5}})
# task_name: task object or task name string, if there is ":", it will automatically change to "/", and finally generate the log directory.
- Output log (Extended ext_logger.info):
batch.info("log content")
batch.debug("log content")
batch.error("log content")
batch.warn("log content")
batch.fatal("log content")
batch.exception(e, {send_mail: ExtBatch::SEND_MAIL_NO/ExtBatch::SEND_MAIL_YES}) # when rescure Exception => e, send_mail default ExtBatch::SEND_MAIL_NO
- Send mail:
batch.mail_ok({content: "mail content"})
batch.mail_error({content: "mail content"})
batch.mail_warn({content: "mail content"})
batch.mail_exception(e, {content: "mail content"}) # when rescure Exception => e
- Real-time display time:
batch.show_use_time
- Batch termination processing:
batch.end
Development
After checking out the repo, run bin/setup
to install dependencies. 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]/ext_batch.
License
The gem is available as open source under the terms of the MIT License.