Project

logger2r

0.0
No commit activity in last 3 years
No release in over 3 years
Some extensions for ruby logger
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Logger2r

Gem Version Code Climate Dependency Status

Wrapper class for rubby Logger. Allow to initialize the Logger class for specific progname, and configure it based on yaml config. Inspired by Log4r's yamlconfigurator.

Installation

Add this line to your application's Gemfile:

gem 'logger2r'

And then execute:

$ bundle

Or install it yourself as:

$ gem install logger2r

Usage

Prepare yaml config file:

---
:logger2r_config:
  :default:
    :severity_level: :info
    :device: "stdout"
  :MyClass:
    :severity_level: :warn
    :datetime_format: "%y-%m-%d"
require "logger2r"
Logger2r.config_file = ...my_yaml_file...

class MyClass
  def initialize
    @logger = Logger2r.for_class(self.class.name)
  end
  def foo
    @logger.error "AAAA"
  end
end

Configuration

Each configuration block for specific class may contains

severity_level - symbol, :debug < :info < :warn < :error < :fatal < :unknown device - string, stdout, stderr, ClassName or file path datetime_format - string formatter_class - string, ClassName

Versioning

See semver.org

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request