From afd1840d9d02178e451fe897bc21400105aa0fb3 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 10 Sep 2009 11:49:50 -0700 Subject: Only print python exception tracebacks if debugging is enabled. Uses sys.excepthook to replace the toplevel exception handler with a version that obeys the debug level of the 'default' messaging domain. A non-zero value there will result in displaying the full traceback. Signed-off-by: Chris Larson --- bin/bitbake | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bin') diff --git a/bin/bitbake b/bin/bitbake index 3fda4a012..f02630b10 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -48,6 +48,17 @@ class BBConfiguration( object ): setattr( self, key, val ) +def print_exception(exc, value, tb): + """ + Print the exception to stderr, only showing the traceback if bitbake + debugging is enabled. + """ + if not bb.msg.debug_level['default']: + tb = None + + sys.__excepthook__(exc, value, tb) + + #============================================================================# # main #============================================================================# @@ -148,6 +159,8 @@ Default BBFILES are the .bb files in the current directory.""" ) daemonize.createDaemon(cooker.serve, cooker_logfile) del cooker + sys.excepthook = print_exception + # Setup a connection to the server (cooker) server = xmlrpclib.Server("http://%s:%s" % (host, port), allow_none=True) # Setup an event receiving queue -- cgit 1.2.3-korg