From 6462e03109be39a7e6e82ba5c49874d4652b5810 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 4 Jul 2009 20:13:22 +0000 Subject: Clean up and consolidate traceback. Add methods to hide (some of the) mucking about with msg.type variables. Include query PDU tags in reply PDUs. svn path=/rpkid/irbe-setup.py; revision=2571 --- rpkid/rpki/log.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'rpkid/rpki/log.py') 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()) -- cgit v1.2.3