How To Use The Logger - michaeltelford/wgit GitHub Wiki

This article details how to access and set Wgit’s Logger instance and discusses what gets logged.

Wgit provides methods to manipulate the Logger it uses:

require 'wgit'

Wgit.logger # => #<Logger:0x000000000XXX ...> using STDOUT.
Wgit.logger = Logger.new('wgit.log') # Override the logger with your own.

Wgit.use_default_logger # => Set and use the default logger again.
Wgit.logger.level # => 1 (aka Logger::INFO)

# Override the specifics of the Logger as necessary.
Wgit.logger.level = Logger::DEBUG

# Log your own information using the usual Logger methods.
Wgit.logger.info('Operation complete!')

Change the logger level to control how much log output is generated. For example, (at the time of writing) the default Wgit logger level is INFO which will display information during a Wgit::Indexer operation. If the level is changed to DEBUG then the Wgit::Crawler class will also log HTTP request/response information.