summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-10-05 20:24:58 +0200
committerKrzysztof <kkszysiu@gmail.com>2011-03-27 16:58:44 +0200
commit16ddc67ea21da549fc1f386d27b747f74c5eaff0 (patch)
treea0065d44ebc8f77a13d7bae686b9b6f868a75311
parentbc94628843506020999bd66a4915e50ab0f4584c (diff)
Some fixed and improved logger.
-rw-r--r--sunshine/connection.py5
-rw-r--r--sunshine/contacts_info.py2
-rw-r--r--sunshine/handle.py2
-rwxr-xr-xtelepathy-sunshine3
4 files changed, 9 insertions, 3 deletions
diff --git a/sunshine/connection.py b/sunshine/connection.py
index 2d93dd9..b8a0d6f 100644
--- a/sunshine/connection.py
+++ b/sunshine/connection.py
@@ -52,6 +52,8 @@ from sunshine.util.decorator import async, stripHTML, unescape
__all__ = ['GaduClientFactory', 'SunshineConnection']
logger = logging.getLogger('Sunshine.Connection')
+observer = log.PythonLoggingObserver(loggerName='Sunshine.Connection')
+observer.start()
#SSL
ssl_support = False
@@ -485,8 +487,9 @@ class SunshineConnection(telepathy.server.Connection,
telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)
reactor.stop()
- @async
+ #@async
def on_updateContact(self, contact):
+ #handle = SunshineHandleFactory(self, 'contact', str(contact.uin))
handle_id = self.get_handle_id_by_name(telepathy.constants.HANDLE_TYPE_CONTACT, str(contact.uin))
handle = self.handle(telepathy.constants.HANDLE_TYPE_CONTACT, handle_id)
logger.info("Method on_updateContact called, status changed for UIN: %s, id: %s, status: %s, description: %s" % (contact.uin, handle.id, contact.status, contact.get_desc()))
diff --git a/sunshine/contacts_info.py b/sunshine/contacts_info.py
index d7e0060..68a65f4 100644
--- a/sunshine/contacts_info.py
+++ b/sunshine/contacts_info.py
@@ -26,7 +26,7 @@ import telepathy
import telepathy.constants
import telepathy.errors
-from twisted.internet.defer import Deferred
+from twisted.internet import defer
from sunshine.handle import SunshineHandleFactory
from sunshine.util.decorator import async
diff --git a/sunshine/handle.py b/sunshine/handle.py
index d26d442..23b994a 100644
--- a/sunshine/handle.py
+++ b/sunshine/handle.py
@@ -95,7 +95,7 @@ class SunshineSelfHandle(SunshineHandle):
class SunshineContactHandle(SunshineHandle):
#TODO: GG using just UIN to indenrify user so we need just contact_uin instead of contact_account and contact_network)
- def __init__(self, connection, id, contact_account, contact_network):
+ def __init__(self, connection, id, contact_account, contact_network=None):
handle_type = telepathy.HANDLE_TYPE_CONTACT
handle_name = str(contact_account)
self.account = str(contact_account)
diff --git a/telepathy-sunshine b/telepathy-sunshine
index 40d401d..d1dc536 100755
--- a/telepathy-sunshine
+++ b/telepathy-sunshine
@@ -6,6 +6,7 @@ import signal
import os
import sys
import logging
+from twisted.python import log
from twisted.internet import gtk2reactor
gtk2reactor.install()
@@ -30,6 +31,8 @@ from sunshine import SunshineDebug
from sunshine.util.decorator import async
logger = logging.getLogger('Sunshine')
+observer = log.PythonLoggingObserver(loggerName='Sunshine')
+observer.start()
IDLE_TIMEOUT = 5000
PROCESS_NAME = 'telepathy-sunshine'