Don't output initial blurb in "quiet" mode

When logging to a file using the -l switch, we would still write an initial
banner to the file. This was never intended. Quiet should be really quiet
unless it experiences an error. Simplify the logging statement, to do nothing
if logevel is set to "WARNING" aka quiet.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-08-31 23:11:11 +02:00
parent 3cb2ddccb8
commit a1dc76ae91

View File

@ -88,7 +88,6 @@ class UIBase(object):
def setlogfile(self, logfile): def setlogfile(self, logfile):
"""Create file handler which logs to file""" """Create file handler which logs to file"""
fh = logging.FileHandler(logfile, 'at') fh = logging.FileHandler(logfile, 'at')
#fh.setLevel(logging.DEBUG)
file_formatter = logging.Formatter("%(asctime)s %(levelname)s: " file_formatter = logging.Formatter("%(asctime)s %(levelname)s: "
"%(message)s", '%Y-%m-%d %H:%M:%S') "%(message)s", '%Y-%m-%d %H:%M:%S')
fh.setFormatter(file_formatter) fh.setFormatter(file_formatter)
@ -98,9 +97,7 @@ class UIBase(object):
msg = "OfflineImap %s starting...\n Python: %s Platform: %s\n "\ msg = "OfflineImap %s starting...\n Python: %s Platform: %s\n "\
"Args: %s" % (offlineimap.__version__, p_ver, sys.platform, "Args: %s" % (offlineimap.__version__, p_ver, sys.platform,
" ".join(sys.argv)) " ".join(sys.argv))
record = logging.LogRecord('OfflineImap', logging.INFO, __file__, self.logger.info(msg)
None, msg, None, None)
fh.emit(record)
def _msg(self, msg): def _msg(self, msg):
"""Display a message.""" """Display a message."""