add the repository name when connecting
Otherwise, it might be impossible to know which account is connecting when more than one is syncing. Code style. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
9aa5afa951
commit
203c28f21f
@ -342,7 +342,8 @@ class SyncableAccount(Account):
|
||||
# Iterate through all folders on the remote repo and sync.
|
||||
for remotefolder in remoterepos.getfolders():
|
||||
# Check for CTRL-C or SIGTERM.
|
||||
if Account.abort_NOW_signal.is_set(): break
|
||||
if Account.abort_NOW_signal.is_set():
|
||||
break
|
||||
|
||||
if not remotefolder.sync_this:
|
||||
self.ui.debug('', "Not syncing filtered folder '%s'"
|
||||
|
@ -484,7 +484,8 @@ class IMAPServer(object):
|
||||
while success is not True:
|
||||
# Generate a new connection.
|
||||
if self.tunnel:
|
||||
self.ui.connecting('tunnel', self.tunnel)
|
||||
self.ui.connecting(
|
||||
self.repos.getname(), 'tunnel', self.tunnel)
|
||||
imapobj = imaplibutil.IMAP4_Tunnel(
|
||||
self.tunnel,
|
||||
timeout=socket.getdefaulttimeout(),
|
||||
@ -492,7 +493,8 @@ class IMAPServer(object):
|
||||
)
|
||||
success = True
|
||||
elif self.usessl:
|
||||
self.ui.connecting(self.hostname, self.port)
|
||||
self.ui.connecting(
|
||||
self.repos.getname(), self.hostname, self.port)
|
||||
imapobj = imaplibutil.WrappedIMAP4_SSL(
|
||||
host=self.hostname,
|
||||
port=self.port,
|
||||
@ -508,7 +510,8 @@ class IMAPServer(object):
|
||||
af=self.af,
|
||||
)
|
||||
else:
|
||||
self.ui.connecting(self.hostname, self.port)
|
||||
self.ui.connecting(
|
||||
self.repos.getname(), self.hostname, self.port)
|
||||
imapobj = imaplibutil.WrappedIMAP4(
|
||||
self.hostname, self.port,
|
||||
timeout=socket.getdefaulttimeout(),
|
||||
|
@ -25,10 +25,11 @@ from threading import currentThread
|
||||
import offlineimap
|
||||
from offlineimap.ui.UIBase import UIBase
|
||||
|
||||
protocol = '7.1.0'
|
||||
protocol = '7.2.0'
|
||||
|
||||
class MachineLogFormatter(logging.Formatter):
|
||||
"""urlencodes any outputted line, to avoid multi-line output"""
|
||||
|
||||
def format(s, record):
|
||||
# Mapping of log levels to historic tag names
|
||||
severity_map = {
|
||||
@ -101,8 +102,9 @@ class MachineUI(UIBase):
|
||||
(folder.getname(), folder.getrepository().getname(),
|
||||
folder.get_saveduidvalidity(), folder.get_uidvalidity()))
|
||||
|
||||
def connecting(s, hostname, port):
|
||||
s._printData(s.logger.info, 'connecting', "%s\n%s"% (hostname, str(port)))
|
||||
def connecting(s, reposname, hostname, port):
|
||||
s._printData(s.logger.info, 'connecting', "%s\n%s\nMs"% (hostname,
|
||||
str(port), reposname))
|
||||
|
||||
def syncfolders(s, srcrepos, destrepos):
|
||||
s._printData(s.logger.info, 'syncfolders', "%s\n%s"% (s.getnicename(srcrepos),
|
||||
|
@ -19,9 +19,11 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
from getpass import getpass
|
||||
|
||||
from offlineimap import banner
|
||||
from offlineimap.ui.UIBase import UIBase
|
||||
|
||||
|
||||
class TTYFormatter(logging.Formatter):
|
||||
"""Specific Formatter that adds thread information to the log output."""
|
||||
|
||||
|
@ -311,7 +311,7 @@ class UIBase(object):
|
||||
create the application window here."""
|
||||
pass
|
||||
|
||||
def connecting(self, hostname, port):
|
||||
def connecting(self, reposname, hostname, port):
|
||||
"""Log 'Establishing connection to'."""
|
||||
|
||||
if not self.logger.isEnabledFor(logging.INFO): return
|
||||
@ -320,7 +320,8 @@ class UIBase(object):
|
||||
port = "%s"% port if port else ''
|
||||
if hostname:
|
||||
displaystr = ' to %s:%s' % (hostname, port)
|
||||
self.logger.info("Establishing connection%s" % displaystr)
|
||||
self.logger.info("Establishing connection%s (%s)"%
|
||||
(displaystr, reposname))
|
||||
|
||||
def acct(self, account):
|
||||
"""Output that we start syncing an account (and start counting)."""
|
||||
|
Loading…
Reference in New Issue
Block a user