Skip to content

Instantly share code, notes, and snippets.

@kxxoling
Created November 27, 2013 05:41
Show Gist options
  • Save kxxoling/7671172 to your computer and use it in GitHub Desktop.
Save kxxoling/7671172 to your computer and use it in GitHub Desktop.
import sys
print 'Dive in'
saveout = sys.stdout
fsock = open('out.log', 'w')
sys.stdout = fsock
print 'This message will be logged instead of displayed'
sys.stdout = saveout
fsock.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment