aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/log.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-07-04 20:13:22 +0000
committerRob Austein <sra@hactrn.net>2009-07-04 20:13:22 +0000
commit6462e03109be39a7e6e82ba5c49874d4652b5810 (patch)
treea1154f496b34145a4ac0797505f6619727af3fb2 /rpkid/rpki/log.py
parent6baa092a44b6ae9d1ffddc8fc6928c9bbb368124 (diff)
Clean up and consolidate traceback. Add methods to hide (some of the)
mucking about with msg.type variables. Include query PDU tags in reply <report_error/> PDUs. svn path=/rpkid/irbe-setup.py; revision=2571
Diffstat (limited to 'rpkid/rpki/log.py')
-rw-r--r--rpkid/rpki/log.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/rpkid/rpki/log.py b/rpkid/rpki/log.py
index 77a5c67c..f7163733 100644
--- a/rpkid/rpki/log.py
+++ b/rpkid/rpki/log.py
@@ -32,7 +32,8 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import syslog, traceback, sys, os, time
+import syslog, sys, os, time
+import traceback as tb
## @var enable_trace
# Whether call tracing is enabled.
@@ -93,5 +94,14 @@ def trace():
"""
if enable_trace:
- bt = traceback.extract_stack(limit = 3)
+ bt = tb.extract_stack(limit = 3)
return debug("[%s() at %s:%d from %s:%d]" % (bt[1][2], bt[1][0], bt[1][1], bt[0][0], bt[0][1]))
+
+def traceback():
+ """
+ Consolidated backtrace facility with a bit of extra info.
+ """
+
+ bt = tb.extract_stack(limit = 3)
+ error("Exception caught in %s() at %s:%d called from %s:%d" % (bt[1][2], bt[1][0], bt[1][1], bt[0][0], bt[0][1]))
+ error(tb.format_exc())