summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/mail/imap/server.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-10-05 12:28:14 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-10-07 10:22:36 -0400
commit99b53c1714d302d7f0884e03b5c102081c483504 (patch)
tree82ac74e776a330338bf94563273aa4d33f578877 /src/leap/bitmask/mail/imap/server.py
parent4a471fb8b434d3df07c5de42fc41590b5d9fc5f5 (diff)
[refactor] use new logger infrastructure
Diffstat (limited to 'src/leap/bitmask/mail/imap/server.py')
-rw-r--r--src/leap/bitmask/mail/imap/server.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/leap/bitmask/mail/imap/server.py b/src/leap/bitmask/mail/imap/server.py
index 5a63af01..897e1f05 100644
--- a/src/leap/bitmask/mail/imap/server.py
+++ b/src/leap/bitmask/mail/imap/server.py
@@ -22,7 +22,7 @@ from copy import copy
from twisted.internet.defer import maybeDeferred
from twisted.mail import imap4
-from twisted.python import log
+from twisted.logger import Logger
# imports for LITERAL+ patch
from twisted.internet import defer, interfaces
@@ -32,6 +32,9 @@ from twisted.mail.imap4 import LiteralString, LiteralFile
from leap.common.events import emit_async, catalog
+logger = Logger()
+
+
def _getContentType(msg):
"""
Return a two-tuple of the main and subtype of the given message.
@@ -164,7 +167,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
msg = line[:7] + " [...]"
else:
msg = copy(line)
- log.msg('rcv (%s): %s' % (self.state, msg))
+ logger.debug('rcv (%s): %s' % (self.state, msg))
imap4.IMAP4Server.lineReceived(self, line)
def close_server_connection(self):
@@ -449,7 +452,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
def _subscribeEb(failure):
m = failure.value
- log.err()
+ logger.error()
if failure.check(imap4.MailboxException):
self.sendNegativeResponse(tag, str(m))
else:
@@ -474,7 +477,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
def _unsubscribeEb(failure):
m = failure.value
- log.err()
+ logger.error()
if failure.check(imap4.MailboxException):
self.sendNegativeResponse(tag, str(m))
else:
@@ -509,7 +512,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
elif failure.check(imap4.MailboxException):
self.sendNegativeResponse(tag, str(m))
else:
- log.err()
+ logger.error()
self.sendBadResponse(
tag,
"Server error encountered while "
@@ -536,7 +539,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
if failure.check(imap4.MailboxException):
self.sendNegativeResponse(tag, str(c))
else:
- log.err()
+ logger.error()
self.sendBadResponse(
tag, "Server error encountered while creating mailbox")
@@ -561,8 +564,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
if failure.check(imap4.MailboxException):
self.sendNegativeResponse(tag, str(m))
else:
- print "SERVER: other error"
- log.err()
+ logger.error()
self.sendBadResponse(
tag,
"Server error encountered while deleting mailbox")
@@ -598,7 +600,7 @@ class LEAPIMAPServer(imap4.IMAP4Server):
def _ebAppendGotMailbox(self, failure, tag):
self.sendBadResponse(
tag, "Server error encountered while opening mailbox.")
- log.err(failure)
+ logger.error(failure)
def __cbAppend(self, result, tag, mbox):