https://github.com/yegor256/verbose
A decorator of an object that makes it protocol every method call
https://github.com/yegor256/verbose
ruby ruby-gem
Last synced: about 1 year ago
JSON representation
A decorator of an object that makes it protocol every method call
- Host: GitHub
- URL: https://github.com/yegor256/verbose
- Owner: yegor256
- License: mit
- Created: 2024-06-13T11:50:16.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-16T10:55:47.000Z (almost 2 years ago)
- Last Synced: 2024-09-16T12:28:24.766Z (almost 2 years ago)
- Topics: ruby, ruby-gem
- Language: Ruby
- Homepage: https://rubygems.org/gems/verbose
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# A Decorator that Logs Every Method Call of a Decoratee
[](http://www.rultor.com/p/yegor256/verbose)
[](https://www.jetbrains.com/ruby/)
[](https://github.com/yegor256/verbose/actions/workflows/rake.yml)
[](http://www.0pdd.com/p?name=yegor256/verbose)
[](http://badge.fury.io/rb/verbose)
[](https://codecov.io/github/yegor256/verbose?branch=master)
[](http://rubydoc.info/github/yegor256/verbose/master/frames)
[](https://hitsofcode.com/view/github/yegor256/verbose)
[](https://github.com/yegor256/verbose/blob/master/LICENSE.txt)
Here is how you use it:
```ruby
require 'verbose'
x = MyObject.new
v = Verbose.new(x)
v.foo() # see the logging line in the console
```
Instead of printing to the console, you can pass an instance
of the [Logger][logger] class to the `Verbose` constructor:
```ruby
require 'verbose'
require 'logger'
x = MyObject.new
v = Verbose.new(x, log: Logger.new(STDOUT))
v.foo()
```
I also recommend you to check the
[`loog`](https://github.com/yegor256/loog) gem,
for more object-oriented logging.
## How to contribute
Read
[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
Make sure your build is green before you contribute
your pull request. You will need to have
[Ruby](https://www.ruby-lang.org/en/) 3.2+ and
[Bundler](https://bundler.io/) installed. Then:
```bash
bundle update
bundle exec rake
```
If it's clean and you don't see any error messages, submit your pull request.
[logger]: https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html