summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-03-17 12:14:29 -0300
committerTomás Touceda <chiiph@leap.se>2014-03-17 12:14:29 -0300
commitff63167fbb4391a063fdbc29903fdad5a48c55bc (patch)
tree12fecfdccf58e496806e38e8c3bf0cd449fc2275 /scripts
parente51d656532294fa1bdf2a78ccd8426ccb97dd07c (diff)
parent35bf9f390db15e74ad4e37b6fc7fac9d6d7ca658 (diff)
Merge remote-tracking branch 'refs/remotes/drebs/feature/5008_parallelize-get_docs-on-couch-backend' into develop
Diffstat (limited to 'scripts')
-rw-r--r--scripts/db_access/client_side_db.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/db_access/client_side_db.py b/scripts/db_access/client_side_db.py
index 15980f5d..2bf4ab5e 100644
--- a/scripts/db_access/client_side_db.py
+++ b/scripts/db_access/client_side_db.py
@@ -13,17 +13,24 @@ import requests
import json
import srp._pysrp as srp
import binascii
+import logging
from leap.common.config import get_path_prefix
from leap.soledad.client import Soledad
+# create a logger
+logger = logging.getLogger(__name__)
+LOG_FORMAT = '%(asctime)s %(message)s'
+logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)
+
+
safe_unhexlify = lambda x: binascii.unhexlify(x) if (
len(x) % 2 == 0) else binascii.unhexlify('0' + x)
def fail(reason):
- print 'Fail: ' + reason
+ logger.error('Fail: ' + reason)
exit(2)
@@ -94,6 +101,8 @@ def get_soledad_instance(username, provider, passphrase, basedir):
# setup soledad info
uuid, server_url, cert_file, token = \
get_soledad_info(username, provider, passphrase, basedir)
+ logger.info('UUID is %s' % uuid)
+ logger.info('Server URL is %s' % server_url)
secrets_path = os.path.join(
basedir, '%s.secret' % uuid)
local_db_path = os.path.join(
@@ -138,7 +147,7 @@ if __name__ == '__main__':
basedir = args.basedir
if basedir is None:
basedir = tempfile.mkdtemp()
- print 'Using %s as base directory.' % basedir
+ logger.info('Using %s as base directory.' % basedir)
# get the soledad instance
s = get_soledad_instance(