add verbose output

This commit is contained in:
n 2022-02-27 10:20:35 +01:00
parent 6e6a7baaca
commit 20cfcf3568
Signed by: n
GPG Key ID: 510227DD6C502CE3
1 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,8 @@ def main(host='localhost', port=8086, user='root', password='root', dbname='demo
ts=0 ts=0
lastdate=0 lastdate=0
print("last entry is %s, ts is %s" % (lastdate,ts)) if args.verbose:
print("last entry is %s, ts is %s\n" % (lastdate,ts))
con = lite.connect(dbfile) con = lite.connect(dbfile)
with con: with con:
@ -46,7 +47,9 @@ def main(host='localhost', port=8086, user='root', password='root', dbname='demo
} }
] ]
#print(data) if args.verbose:
print("writing data for %s" % (mytime))
db.write_points(data) db.write_points(data)
db.close() db.close()
@ -54,6 +57,9 @@ def parse_args():
"""Parse the args from main.""" """Parse the args from main."""
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Export Pacer data to InfluxDB') description='Export Pacer data to InfluxDB')
parser.add_argument('--verbose', required=False,
action="store_true",
help='verbose output')
parser.add_argument('--host', type=str, required=False, parser.add_argument('--host', type=str, required=False,
default='localhost', default='localhost',
help='hostname of InfluxDB http API') help='hostname of InfluxDB http API')