From 6b79e643f7a4ad2341914d406823a7d5eac0b513 Mon Sep 17 00:00:00 2001
From: Alan De Smet <alan.desmet@ssec.wisc.edu>
Date: Fri, 3 Sep 2021 16:07:16 +0000
Subject: [PATCH] Remove logging.progress
It's no longer needed and it was an over-clever hack. #6
---
example/aitf-data-for-run | 6 +++---
example/aitf/argparsetools.py | 3 ++-
example/aitf/conlog.py | 2 --
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/example/aitf-data-for-run b/example/aitf-data-for-run
index 8a0e889..7b3e66b 100755
--- a/example/aitf-data-for-run
+++ b/example/aitf-data-for-run
@@ -108,21 +108,21 @@ def main():
try:
- logging.progress("Acquiring SST")
+ if args.want_progress: sys.stderr.write("Acquiring SST\n")
sststats = aitf.ancil.SST.download_for_time(args.scan_time, args.cache, do_download = do_download, progress=progress)
sst_files = sststats.all_files()
log_download_report("SST Download Summary", sststats)
# using SST instead of GFS to show that
# DownloadStatistics are interchangable.
- logging.progress("Acquiring GFS")
+ if args.want_progress: sys.stderr.write("Acquiring GFS\n")
gfsstats = aitf.ancil.GFS.download_for_time(args.scan_time, args.cache, do_download = do_download, progress=progress)
gfs_files = gfsstats.all_files()
log_download_report("GFS Download Summary", gfsstats)
log_download_report("Total Download Summary", sststats + gfsstats)
- logging.progress("Symbolically linking into place")
+ if args.want_progress: sys.stderr.write("Symbolically linking into place\n")
all_files = list(sst_files) + list(gfs_files)
for destination in args.destination:
for file in all_files:
diff --git a/example/aitf/argparsetools.py b/example/aitf/argparsetools.py
index b64c30b..c7ad4b5 100644
--- a/example/aitf/argparsetools.py
+++ b/example/aitf/argparsetools.py
@@ -39,7 +39,8 @@ def initialize_logging_level_info():
logging_levels = [ ('warnings', logging.WARNING) ]
# These are from conlog, but I don't want to depend on them.
if hasattr(logging,'SUMMARY'): logging_levels += [ ('a summary', logging.SUMMARY) ]
- if hasattr(logging,'PROGRESS'): logging_levels += [ ('progress', logging.PROGRESS) ]
+ # Not a "real" logging level
+ logging_levels += [ ('progress', logging_levels[-1][1]) ]
logging_levels += [('general information', logging.INFO),
('debugging information', logging.DEBUG) ]
diff --git a/example/aitf/conlog.py b/example/aitf/conlog.py
index 0915147..24457b2 100644
--- a/example/aitf/conlog.py
+++ b/example/aitf/conlog.py
@@ -44,7 +44,6 @@ def add_console_logging():
labels = {
logging.DEBUG: "debug: ",
logging.INFO: "",
- logging.PROGRESS: "",
logging.SUMMARY: "",
logging.WARNING: "Warning: ",
logging.ERROR: "ERROR: ",
@@ -70,6 +69,5 @@ def add_console_logging():
def setup_logging():
create_log_level(25, "SUMMARY")
- create_log_level(22, "PROGRESS")
logging.basicConfig()
add_console_logging()
--
GitLab