Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Cameron <quozl@laptop.org>2014-09-22 01:35:15 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2014-09-24 11:45:11 (GMT)
commitf730d6d2f01356caf805445f621b9cc58af06927 (patch)
tree7f867cfd6787bbc11a40c206f1c1a7ebbd665ca5
parentb4c7fcad2578e65a9ccd574fa99ca574bdbb86e0 (diff)
logcollect: collect previous Sugar session logs
Log collections only included the current Sugar session. Change to collect previous logs as well.
-rw-r--r--logcollect.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/logcollect.py b/logcollect.py
index 5800229..7ee6fc1 100644
--- a/logcollect.py
+++ b/logcollect.py
@@ -316,21 +316,37 @@ class LogCollect:
except Exception, e:
z.writestr('var-log/'+fn,
"logcollect: could not add %s: %s" % (fn, e))
-
- # Include all current ones from sugar/logs
+
home = os.path.expanduser('~')
- for path in glob.glob(os.path.join(home, '.sugar', 'default',
- 'logs', '*.log')):
- try:
- if os.access(path, os.F_OK):
+ here = os.path.join(home, '.sugar/default/logs/*.log')
+ for path in glob.glob(here):
+ if os.access(path, os.F_OK):
+ pref = 'sugar-logs/'
+ name = os.path.join(pref, os.path.basename(path))
+ try:
if logbytes == 0:
- z.write(path, 'sugar-logs/'+os.path.basename(path))
+ z.write(path, name)
else:
- z.writestr('sugar-logs/'+os.path.basename(path),
+ z.writestr(name,
self.file_tail(path, logbytes))
- except Exception, e:
- z.writestr('sugar-logs/'+fn,
- "logcollect: could not add %s: %s" % (fn, e))
+ except Exception, e:
+ z.writestr(name,
+ "logcollect: could not add %s: %s" % (name, e))
+ here = os.path.join(home, '.sugar/default/logs/*/*.log')
+ for path in glob.glob(here):
+ if os.access(path, os.F_OK):
+ when = os.path.basename(os.path.dirname(path))
+ pref = 'sugar-logs-%s/' % when
+ name = os.path.join(pref, os.path.basename(path))
+ try:
+ if logbytes == 0:
+ z.write(path, name)
+ else:
+ z.writestr(name,
+ self.file_tail(path, logbytes))
+ except Exception, e:
+ z.writestr(name,
+ "logcollect: could not add %s: %s" % (name, e))
try:
z.write('/etc/resolv.conf')
except Exception, e: