Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-03-20 02:34:02 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-03-20 02:34:02 (GMT)
commitada4b2b870d61029ed4f94008faa83e1fbcd1608 (patch)
treeebe4f69c8a49a805f3e752c070195152187c280d /utils.py
parentac4354dc0511286e8f480aa78d3f16ce47b30d17 (diff)
Use logging
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index 3cacab5..bdd0939 100644
--- a/utils.py
+++ b/utils.py
@@ -23,14 +23,25 @@ import gtk
import time
import json
import urllib
+import logging
from sugar.activity import activity
from sugar.bundle.activitybundle import ActivityBundle
+# Paths
LIST_DOWNLOAD = "https://sites.google.com/site/agustinzubiaga/archivos/store.lst"
LIST_PATH = os.path.join(activity.get_activity_root(), 'data', 'store.lst')
TMP_DIR = os.path.join(activity.get_activity_root(), "tmp")
+# Logging
+_logger = logging.getLogger('activitiesstore-activity')
+_logger.setLevel(logging.DEBUG)
+logging.basicConfig()
+
+
+def get_logger():
+ return _logger
+
def update_list():
"""Download the latest list version"""
@@ -82,10 +93,12 @@ def download_activity(id, progress_function):
xo = '%s.xo' % activity_obj['Name'].replace('=', '')
file_path = os.path.join(activity.get_activity_root(), "data", "%s" % (xo))
+ _logger.info("Downloading activity (%s)")
urllib.urlretrieve(activity_obj['Download'],
file_path,
reporthook=progress_changed)
+ _logger.info("Installing activity (%s)")
install_activity(file_path, progress_function)
@@ -103,3 +116,5 @@ def install_activity(xofile, progress_function):
# Show "Installed..." message
progress_function(200)
+
+ _logger.info("Activity installed! (%s)")