Add logging command line switch

This commit is contained in:
Dan Srebnick 2017-09-28 11:19:57 -04:00
parent 8634a7b933
commit 16519ee35a
4 changed files with 22 additions and 10 deletions

5
README
View File

@ -36,6 +36,9 @@ aprx.log, then you likely need to add the timeout.
The program will check for a new alert or update every 2 minutes, but only
send if there is a change.
For visibility into noaacap's actions via the systemd journal, you may add
--info or --debug to the exec command line for more verbose logging.
Edit /etc/noaacap.conf:
Do not remove the [noaacap] section header.
@ -60,4 +63,4 @@ k2dls@k2dls.net with the callsign-SSID of your APRS station that is sending
weather alerts via this program.
Dan Srebnick, K2DLS
09/13/2017
09/28/2017

View File

@ -24,15 +24,20 @@ from systemd.journal import JournalHandler
log = logging.getLogger('noaacap')
log.addHandler(JournalHandler(SYSLOG_IDENTIFIER='noaacap'))
log.setLevel(logging.INFO)
log.info("Starting")
if len(sys.argv) == 2 and sys.argv[1] == '-v':
print("noaacap.py by K2DLS, version " + version + "\n")
print("A weather alert beacon exec for aprx >= 2.9")
print("Licensed under the BSD 2 Clause license")
print("Copyright 2017 by Daniel L. Srebnick\n")
sys.exit(0)
if len(sys.argv) == 2:
if sys.argv[1] == '-v':
print("noaacap.py by K2DLS, version " + version + "\n")
print("A weather alert beacon exec for aprx >= 2.9")
print("Licensed under the BSD 2 Clause license")
print("Copyright 2017 by Daniel L. Srebnick\n")
sys.exit(0)
elif sys.argv[1] == "--info":
log.setLevel(logging.INFO)
elif sys.argv[1] == "--debug":
log.setLevel(logging.DEBUG)
log.info("Starting")
# We need this function early in execution
def Exiting():

View File

@ -3,6 +3,7 @@ noaacap changelog
Version: 0.7
Release: TBD
Added myResend parameter to control message resends.
Added command line parameters --info and --debug to control logging
##
Version: 0.6
Release: September 15, 2017

View File

@ -31,6 +31,9 @@ aprx.log, then you likely need to add the timeout.
The program will check for a new alert or update every 2 minutes, but only
send if there is a change.
For visibility into noaacap's actions via the systemd journal, you may add
--info or --debug to the exec command line for more verbose logging.
Edit /etc/noaacap.conf:
Do not remove the [noaacap] section header.
@ -55,4 +58,4 @@ k2dls@k2dls.net with the callsign-SSID of your APRS station that is sending
weather alerts via this program.
Dan Srebnick, K2DLS
09/13/2017
09/28/2017