summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2013-12-20 13:44:53 -0400
committerKali Kaneko <kali@leap.se>2013-12-20 13:44:53 -0400
commit8ba650488ea1f1a50b4c22758f647c9f2ee7839d (patch)
tree1c5dc409dbcb83b60faf68c8a867ccf97dceabf2 /src/leap
parent52054730687efbd08efa1d36e30074d789ae2d08 (diff)
mail logs
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/app.py2
-rw-r--r--src/leap/bitmask/config/flags.py2
-rw-r--r--src/leap/bitmask/services/mail/imap.py12
-rw-r--r--src/leap/bitmask/services/soledad/soledadbootstrapper.py4
-rw-r--r--src/leap/bitmask/util/leap_argparse.py5
5 files changed, 19 insertions, 6 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index 3bf4575e..b16a51aa 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -183,6 +183,7 @@ def main():
bypass_checks = getattr(opts, 'danger', False)
debug = opts.debug
logfile = opts.log_file
+ mail_logfile = opts.mail_log_file
openvpn_verb = opts.openvpn_verb
try:
@@ -198,6 +199,7 @@ def main():
from leap.bitmask.config import flags
from leap.common.config.baseconfig import BaseConfig
flags.STANDALONE = standalone
+ flags.MAIL_LOGFILE = mail_logfile
BaseConfig.standalone = standalone
logger = add_logger_handlers(debug, logfile)
diff --git a/src/leap/bitmask/config/flags.py b/src/leap/bitmask/config/flags.py
index 98395def..ba1b65b9 100644
--- a/src/leap/bitmask/config/flags.py
+++ b/src/leap/bitmask/config/flags.py
@@ -30,3 +30,5 @@ WARNING: You should NOT use this kind of flags unless you're sure of what
# - search for binaries inside the bundled app instead of the system ones.
# e.g.: openvpn, gpg
STANDALONE = False
+
+MAIL_LOGFILE = None
diff --git a/src/leap/bitmask/services/mail/imap.py b/src/leap/bitmask/services/mail/imap.py
index 2667f156..5db18cb9 100644
--- a/src/leap/bitmask/services/mail/imap.py
+++ b/src/leap/bitmask/services/mail/imap.py
@@ -19,10 +19,10 @@ Initialization of imap service
"""
import logging
import os
-#import sys
+import sys
from leap.mail.imap.service import imap
-#from twisted.python import log
+from twisted.python import log
logger = logging.getLogger(__name__)
@@ -58,15 +58,15 @@ def start_imap_service(*args, **kwargs):
:returns: twisted.internet.task.LoopingCall instance
"""
+ from leap.bitmask.config import flags
logger.debug('Launching imap service')
override_period = get_mail_check_period()
if override_period:
kwargs['check_period'] = override_period
- # Uncomment the next two lines to get a separate debugging log
- # TODO handle this by a separate flag.
- #log.startLogging(open('/tmp/leap-imap.log', 'w'))
- #log.startLogging(sys.stdout)
+ if flags.MAIL_LOGFILE:
+ log.startLogging(open(flags.MAIL_LOGFILE, 'w'))
+ log.startLogging(sys.stdout)
return imap.run_service(*args, **kwargs)
diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
index a92c24a0..3ab62b2e 100644
--- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py
+++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
@@ -302,6 +302,10 @@ class SoledadBootstrapper(AbstractBootstrapper):
except SSLError as exc:
logger.error("%r" % (exc,))
raise SoledadSyncError("Failed to sync soledad")
+ except u1db_errors.InvalidGeneration as exc:
+ logger.error("%r" % (exc,))
+ raise SoledadSyncError("u1db: InvalidGeneration")
+
except Exception as exc:
logger.exception("Unhandled error while syncing "
"soledad: %r" % (exc,))
diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py
index 00192247..6703b600 100644
--- a/src/leap/bitmask/util/leap_argparse.py
+++ b/src/leap/bitmask/util/leap_argparse.py
@@ -41,6 +41,11 @@ Launches Bitmask""", epilog=epilog)
action="store", dest="log_file",
#type=argparse.FileType('w'),
help='optional log file')
+ parser.add_argument('-m', '--mail-logfile',
+ metavar="MAIL LOG FILE", nargs='?',
+ action="store", dest="mail_log_file",
+ #type=argparse.FileType('w'),
+ help='optional log file for email')
parser.add_argument('--openvpn-verbosity', nargs='?',
type=int,
action="store", dest="openvpn_verb",