Revert "Don't output initial blurb in "quiet" mode"

This reverts commit a1dc76ae91.

Causes a crash when using Blinkenlights UI with -l CLI option.

  $ ./offlineimap.py -c offlineimap.conf.minimal -u blinkenlights -l foo
  Traceback (most recent call last):
    File "./offlineimap.py", line 36, in <module>
      oi.run()
    File "/tmp/offlineimap/offlineimap/init.py", line 50, in run
      options, args = self.__parse_cmd_options()
    File "/tmp/offlineimap/offlineimap/init.py", line 205, in __parse_cmd_options
      self.ui.setlogfile(options.logfile)
    File "/tmp/offlineimap/offlineimap/ui/UIBase.py", line 119, in setlogfile
      self.logger.info(msg)
    File "/usr/lib/python2.7/logging/__init__.py", line 1159, in info
      self._log(INFO, msg, args, **kwargs)
    File "/usr/lib/python2.7/logging/__init__.py", line 1278, in _log
      self.handle(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 1288, in handle
      self.callHandlers(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 1328, in callHandlers
      hdlr.handle(record)
    File "/usr/lib/python2.7/logging/__init__.py", line 751, in handle
      self.emit(record)
    File "/tmp/offlineimap/offlineimap/ui/Curses.py", line 305, in emit
      color = self.ui.gettf().curses_color
  AttributeError: 'CursesLogHandler' object has no attribute 'ui'

Reported-by: iliastsi
Github-issue: #293
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-01-08 17:30:54 +01:00
parent cfa704bbf2
commit 1553e843b3

View File

@ -107,6 +107,7 @@ class UIBase(object):
"""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)
@ -116,7 +117,9 @@ 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.__bigversion__, p_ver, sys.platform, "Args: %s"% (offlineimap.__bigversion__, p_ver, sys.platform,
" ".join(sys.argv)) " ".join(sys.argv))
self.logger.info(msg) record = logging.LogRecord('OfflineImap', logging.INFO, __file__,
None, msg, None, None)
fh.emit(record)
def _msg(self, msg): def _msg(self, msg):
"""Display a message.""" """Display a message."""