Project

loog

0.0
A long-lived project that still receives updates
Object-oriented wrapper for Ruby default logging facility
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.0
 Project Readme

Object-Oriented Logger for Ruby

EO principles respected here DevOps By Rultor.com We recommend RubyMine

rake Gem Version Maintainability Yard Docs Test Coverage Hits-of-Code

Loog is an object-oriented logging wrapper around Ruby Logger.

First, install it:

gem install loog

Then, use it like this:

require 'loog'
Loog::VERBOSE.info('Hello, world!')

The gem is basically a provider of a few pre-configured loggers, which you can use for production (Loog::REGULAR) or for testing (Loog::VERBOSE). You can also shut it up with Loog::NULL.

There is also Loog::Buffer class that you can use for testing. It accumulates all log calls and then returns the entire output through the to_s() method.

Also, you can "tee" two loogs, with the help of Loog::Tee. For example, to record everything in a buffer and also show in the console:

require 'loog'
require 'loog/tee'
buf = Loog::Buffer.new
loog = Loog::Tee.new(Loog::VERBOSE, buf)
loog.info('Hello, world!')
assert(buf.to_s.include?('Hello'))

How to contribute

Read these guidelines. Make sure your build is green before you contribute your pull request. You will need to have Ruby 2.3+ and Bundler installed. Then:

bundle update
bundle exec rake

If it's clean and you don't see any error messages, submit your pull request.