A Decorator that Logs Every Method Call of a Decoratee
Here is how you use it:
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 class to the Verbose
constructor:
require 'verbose'
require 'logger'
x = MyObject.new
v = Verbose.new(x, log: Logger.new(STDOUT))
v.foo
I also recommend checking the
loog
gem
for more object-oriented logging.
How to contribute
Read these guidelines. Make sure your build is green before you contribute your pull request. You will need to have Ruby 3.2+ 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.