Permalink
Browse files

Start managing amsn2 and papyon logs

  • Loading branch information...
1 parent c7d7368 commit f2414aaf2b962057f5740db889bcc076936c1d05 @luckyluke luckyluke committed Sep 1, 2009
Showing with 22 additions and 6 deletions.
  1. +3 −1 amsn2.py
  2. +19 −5 amsn2/core/amsn.py
View
@@ -21,8 +21,10 @@
default=None, help="The account's password to use")
parser.add_option("-f", "--front-end", dest="front_end",
default=default_front_end, help="The frontend to use")
- parser.add_option("-d", "--debug", action="store_true", dest="debug",
+ parser.add_option("-d", "--debug-protocol", action="store_true", dest="debug_protocol",
default=False, help="Show protocol debug")
+ parser.add_option("-D", "--debug-amsn2", action="store_true", dest="debug_amsn2",
+ default=False, help="Show amsn2 debug")
(options, args) = parser.parse_args()
amsn = aMSNCore(options)
View
@@ -21,7 +21,6 @@
from amsn2 import gui
from amsn2 import protocol
from amsn2.backend import aMSNBackendManager
-import papyon
from views import *
from account_manager import *
from contactlist_manager import *
@@ -31,6 +30,13 @@
from personalinfo_manager import *
from event_manager import *
+import papyon
+import logging
+
+# Top-level loggers
+papyon_logger = logging.getLogger("papyon")
+logger = logging.getLogger("amsn2")
+
class aMSNCore(object):
def __init__(self, options):
"""
@@ -72,11 +78,18 @@ def __init__(self, options):
papyon.Presence.INVISIBLE:"hidden",
papyon.Presence.OFFLINE:"offline"}
- import logging
- if self._options.debug:
- logging.basicConfig(level=logging.DEBUG)
+ # TODO: redirect the logs somewhere, something like ctrl-s ctrl-d for amsn-0.9x
+ logging.basicConfig(level=logging.WARNING)
+
+ if self._options.debug_protocol:
+ papyon_logger.setLevel(logging.DEBUG)
+ else:
+ papyon_logger.setLevel(logging.WARNING)
+
+ if self._options.debug_amsn2:
+ logger.setLevel(logging.DEBUG)
else:
- logging.basicConfig(level=logging.WARNING)
+ logger.setLevel(logging.WARNING)
def run(self):
self._main.show()
@@ -199,6 +212,7 @@ def quit(self):
if self._account is not None:
self._account.signOut()
self._loop.quit()
+ logging.shutdown()
# TODO: move to UImanager
def addContact(self):

0 comments on commit f2414aa

Please sign in to comment.