Created
June 25, 2015 02:22
-
-
Save takeouchida/cd70b1ca11ce43457a72 to your computer and use it in GitHub Desktop.
A way to log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import traceback | |
# Write a message to /var/log/hoge.log | |
os.system("echo `date '+%Y/%m/%d %H:%M:%S.%N'` 'Some message' >> /var/log/hoge.log") | |
# Write a traceback to /var/log/hoge.log | |
os.system("echo `date '+%Y/%m/%d %H:%M:%S.%N'` '" + traceback.format_exc() + "' >> /var/log/hoge.log") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment