Module | Net::SSH::Loggable |
In: |
lib/net/ssh/loggable.rb
|
A simple module to make logging easier to deal with. It assumes that the logger instance (if not nil) quacks like a Logger object (in Ruby‘s standard library). Although used primarily internally by Net::SSH, it can easily be used to add Net::SSH-like logging to your own programs.
class MyClass include Net::SSH::Loggable end Net::SSH.start(...) do |ssh| obj = MyClass.new obj.logger = ssh.logger ... end
logger | [RW] | The logger instance that will be used to log messages. If nil, nothing will be logged. |
Displays the result of yielding if the log level is Logger::WARN or greater. (Called lwarn to avoid shadowing with Kernel#warn.)