From 6f46047c8630c762d65e20b1aacf02fb25808671 Mon Sep 17 00:00:00 2001 From: delano Date: Thu, 20 Jan 2011 00:03:42 -0500 Subject: Speeding up the Loggable module --- lib/net/ssh/loggable.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/net/ssh/loggable.rb b/lib/net/ssh/loggable.rb index 386dfba..a4ea597 100644 --- a/lib/net/ssh/loggable.rb +++ b/lib/net/ssh/loggable.rb @@ -22,31 +22,31 @@ module Net; module SSH # Displays the result of yielding if the log level is Logger::DEBUG or # greater. def debug - logger.add(Logger::DEBUG, nil, facility) { yield } if logger + logger.add(Logger::DEBUG, nil, facility) { yield } if logger && logger.debug? end # Displays the result of yielding if the log level is Logger::INFO or # greater. def info - logger.add(Logger::INFO, nil, facility) { yield } if logger + logger.add(Logger::INFO, nil, facility) { yield } if logger && logger.info? end # Displays the result of yielding if the log level is Logger::WARN or # greater. (Called lwarn to avoid shadowing with Kernel#warn.) def lwarn - logger.add(Logger::WARN, nil, facility) { yield } if logger + logger.add(Logger::WARN, nil, facility) { yield } if logger && logger.warn? end # Displays the result of yielding if the log level is Logger:ERROR or # greater. def error - logger.add(Logger::ERROR, nil, facility) { yield } if logger + logger.add(Logger::ERROR, nil, facility) { yield } if logger && logger.error? end # Displays the result of yielding if the log level is Logger::FATAL or # greater. def fatal - logger.add(Logger::FATAL, nil, facility) { yield } if logger + logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal? end private -- cgit v1.2.1