- Enhanced parsing of -l/--loglevel option

- Demote one message w/exception to debug
 - Hopefully improved user error message when fingerprint is bad
This commit is contained in:
junglecow 2006-12-27 18:38:50 +00:00
parent 45341476db
commit 847d9fe6e9
3 changed files with 17 additions and 17 deletions

View File

@ -470,8 +470,8 @@ class Connection(ConnectionHandlers):
self.disconnect(on_purpose = True) self.disconnect(on_purpose = True)
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')
self.dispatch('CONNECTION_LOST', self.dispatch('CONNECTION_LOST',
(_('Bad fingerprint for "%s"') % self._hostname, (_('Security error connecting to "%s"') % self._hostname,
_("Server's key changed, or spy attack."))) _("The server's key has changed, or someone is trying to hack your connection.")))
if self.on_connect_auth: if self.on_connect_auth:
self.on_connect_auth(None) self.on_connect_auth(None)
self.on_connect_auth = None self.on_connect_auth = None

View File

@ -423,7 +423,7 @@ class NonBlockingTcp(PlugIn, IdleObject):
# get as many bites, as possible, but not more than RECV_BUFSIZE # get as many bites, as possible, but not more than RECV_BUFSIZE
received = self._recv(RECV_BUFSIZE) received = self._recv(RECV_BUFSIZE)
except (socket.error, socket.herror, socket.gaierror), e: except (socket.error, socket.herror, socket.gaierror), e:
log.error("_do_receive: got %s:", e.__class__, exc_info=True) log.debug("_do_receive: got %s:", e.__class__, exc_info=True)
#traceback.print_exc() #traceback.print_exc()
#print "Current Stack:" #print "Current Stack:"
#traceback.print_stack() #traceback.print_stack()

View File

@ -23,11 +23,11 @@ import urllib
import logging import logging
consoleloghandler = logging.StreamHandler() consoleloghandler = logging.StreamHandler()
consoleloghandler.setLevel(logging.WARNING) consoleloghandler.setLevel(1)
consoleloghandler.setFormatter( consoleloghandler.setFormatter(
logging.Formatter('%(asctime)s %(name)s: %(levelname)s: %(message)s')) logging.Formatter('%(asctime)s %(name)s: %(levelname)s: %(message)s'))
log = logging.getLogger('gajim') log = logging.getLogger('gajim')
log.setLevel(logging.INFO) log.setLevel(logging.WARNING)
log.addHandler(consoleloghandler) log.addHandler(consoleloghandler)
log.propagate = False log.propagate = False
log = logging.getLogger('gajim.gajim') log = logging.getLogger('gajim.gajim')
@ -53,13 +53,12 @@ def parseLogTarget(arg):
return 'gajim.' + arg return 'gajim.' + arg
def parseAndSetLogLevels(arg): def parseAndSetLogLevels(arg):
directives = arg.split(',') for directive in arg.split(','):
for directive in directives:
directive = directive.strip() directive = directive.strip()
target, level = directive.split('=') targets, level = directive.rsplit('=', 1)
target = parseLogTarget(target.strip())
level = parseLogLevel(level.strip()) level = parseLogLevel(level.strip())
for target in targets.split('='):
target = parseLogTarget(target.strip())
if target == '': if target == '':
consoleloghandler.setLevel(level) consoleloghandler.setLevel(level)
print "consoleloghandler level set to %s" % level print "consoleloghandler level set to %s" % level
@ -97,6 +96,7 @@ def parseOpts():
return profile, verbose return profile, verbose
profile, verbose = parseOpts() profile, verbose = parseOpts()
del parseOpts, parseAndSetLogLevels, parseLogTarget, parseLogLevel
import message_control import message_control