Skip to content

Instantly share code, notes, and snippets.

@wbbradley
Created July 15, 2014 06:49
Show Gist options
  • Save wbbradley/baed2cf413bd069a57e3 to your computer and use it in GitHub Desktop.
Save wbbradley/baed2cf413bd069a57e3 to your computer and use it in GitHub Desktop.
import traceback
def log_stack():
with open('/var/tmp/stacktraces.log', 'a') as f:
f.write("-" * 80 + "\n")
f.write("\n".join(repr(s) for s in traceback.extract_stack()
if s[0].find('virtualenv') == -1
and s[0].find('System') == -1
and s[2].find('wrapped') == -1
and s[2].find('decorated_function') == -1
))
f.write("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment