Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
slowrunner committed Mar 18, 2024
1 parent 987bf09 commit 89e3e67
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plib/lifeLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 33 additions & 0 deletions utils/logMaintenance.py
Original file line number Diff line number Diff line change
@@ -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]|<string>
"""

# 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()

0 comments on commit 89e3e67

Please sign in to comment.