Skip to content
Permalink
Browse files
include stack trace in logged python warning messages
  • Loading branch information
jef-n committed Jan 31, 2013
1 parent ec27d28 commit 0a0a430
Showing 1 changed file with 4 additions and 1 deletion.
@@ -46,8 +46,11 @@
warnings.filterwarnings("ignore", "the sets module is deprecated")

def showWarning(message, category, filename, lineno, file=None, line=None):
stk = ""
for s in traceback.format_stack()[:-2]:
stk += s.decode('utf-8', 'replace')
QgsMessageLog.logMessage(
warnings.formatwarning(message, category, filename, lineno),
"warning:%s\ntraceback:%s" % ( warnings.formatwarning(message, category, filename, lineno), stk),
QCoreApplication.translate( "Python", "Python" )
)
warnings.showwarning = showWarning

0 comments on commit 0a0a430

Please sign in to comment.