Skip to content

Commit

Permalink
feat: print -> logger.INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushanand18 authored Sep 8, 2024
1 parent 24c6248 commit 5acfb72
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pyobis/checklist/checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
build_api_url,
handle_arrint,
handle_arrstr,
logger,
obis_baseurl,
obis_GET,
)
Expand Down Expand Up @@ -55,17 +56,14 @@ def execute(self):
pass

# fetch first 10 records, and print number of estimated records
print(f"Estimated records: {out['total']}")
print(
logger.info(f"Estimated records: {out['total']}")
logger.info(
"{}[{}{}] {}".format(
"Fetching: ",
"█" * int(len(out["results"]) * 100 / out["total"]),
"." * (100 - int(len(out["results"]) * 100 / out["total"])),
len(out["results"]),
),
end="\r",
file=sys.stdout,
flush=True,
)
)
# now paginate until the response is null
while True:
Expand All @@ -79,7 +77,7 @@ def execute(self):
break
out["results"] += res["results"]
# print the progress bar
print(
logger.info(
"{}[{}{}] {}".format(
"Fetching: ",
"█" * int(len(out["results"]) * 100 / out["total"]),
Expand All @@ -94,7 +92,7 @@ def execute(self):
# continue to fetch next 5000 records
i += 5000
# print actual number of fetched records
print(f"\nFetched {len(out['results'])} records.")
logger.info(f"\nFetched {len(out['results'])} records.")
else:
out = obis_GET(
self.__url,
Expand Down

0 comments on commit 5acfb72

Please sign in to comment.