/usr/share/pyshared/spyderlib/utils/debug.py is in python-spyderlib 2.1.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Debug utilities"""
import StringIO
import traceback
import time
def log_time(fd):
timestr = "Logging time: %s" % time.ctime(time.time())
print >>fd, "="*len(timestr)
print >>fd, timestr
print >>fd, "="*len(timestr)
print >>fd, ""
def log_last_error(fname, context=None):
"""Log last error in filename *fname* -- *context*: string (optional)"""
out = StringIO.StringIO()
traceback.print_exc(file=out)
fd = open(fname, 'a')
log_time(fd)
if context:
print >>fd, "Context"
print >>fd, "-------"
print >>fd, ""
print >>fd, context
print >>fd, ""
print >>fd, "Traceback"
print >>fd, "---------"
print >>fd, ""
traceback.print_exc(file=fd)
print >>fd, ""
print >>fd, ""
def log_dt(fname, context, t0):
fd = open(fname, 'a')
log_time(fd)
print >>fd, "%s: %d ms" % (context, 10*round(1e2*(time.time()-t0)))
print >>fd, ""
print >>fd, ""
|