diff --git a/plib/lifeLog.py b/plib/lifeLog.py index 98023b8..7b046b2 100755 --- a/plib/lifeLog.py +++ b/plib/lifeLog.py @@ -28,7 +28,7 @@ logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) -loghandler = logging.FileHandler('/home/pi/"+HOME+"/logs/life.log') +loghandler = logging.FileHandler('/home/pi/'+HOME+'/logs/life.log') logformatter = logging.Formatter('%(asctime)s|[%(filename)s.%(funcName)s]%(message)s',"%Y-%m-%d %H:%M") loghandler.setFormatter(logformatter) diff --git a/utils/logMaintenance.py b/utils/logMaintenance.py new file mode 100755 index 0000000..a4045ef --- /dev/null +++ b/utils/logMaintenance.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# +# logMaintenance.py + +""" +Documentation: + logMaintenance.py enters the arguments into the life.log with format: + YYYY-MM-DD HH:MM:SS|[logMaintenance.main]| +""" + +# from __future__ import print_function # use python 3 syntax but make it compatible with python 2 +# from __future__ import division # '' + +import sys + +sys.path.append('/home/pi/GoPi5Go/plib') +import lifeLog + +from time import sleep + + +def main(): + args = sys.argv + if (len(args) == 1): + print('USAGE: ./logMaintenance.py "log this message to life.log"') + else: + strToLog = "** " + args[1] + " **" + lifeLog.logger.info(strToLog) + print("'{}' added to life.log".format(strToLog)) + sleep(1) + + +if (__name__ == '__main__'): main()