-
-
Save thewellington/6736166 to your computer and use it in GitHub Desktop.
I use this script to log everything I do throughout the day
This file contains hidden or 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
#!/usr/bin/env python | |
# myLogger.py by [email protected] - 2012-11-14 | |
# This module takes additional commandline arguments, concatenates them into a | |
# string, and then appends that string to a defined output file. | |
# | |
# Intended to be an easy to access work log for all things that I have completed | |
# | |
# import necessary modules | |
import sys | |
import os | |
import datetime | |
# main() function | |
def main(): | |
now = datetime.datetime.now() | |
tmp = ' '.join(sys.argv[1:]) | |
outfile = '/Users/bwelling/Dropbox/scripts/myLogger/output/done.log' | |
outstr = now.strftime("%Y-%m-%d %H:%M:%S") + ' - ' + tmp + '\n' | |
f=open(outfile,'a') | |
f.write(outstr) | |
f.close() | |
# print sys.argv[0:1] | |
print 'Adding ' + outstr | |
# Call main() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment