BCDA-APS / gemviz

Data visualization for tiled
https://bcda-aps.github.io/gemviz/
Other
4 stars 0 forks source link

prefer logging to print #105

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

During initial development, various diagnostic information was print() to the console. For a package, this console output should be suppressed. Yet the diagnostics still have their value. The Python logging package is commonly used. These diagnostics would be reported at the DEBUG level.

Convert existing print() arguments to use logging and possibly also report to the mainwindow's status bar, as appropriate.

prjemian commented 1 year ago
(bluesky_2023_2) jemian@otz ~/.../gemviz23/demo $ git grep "print"
app_settings.py:    print(f"{ss=}")
app_settings.py:    print(f"{ss.fileName()=}")
app_settings.py:    print(f"{ss.applicationName()=}")
app_settings.py:    print(f"{ss.organizationName()=}")
app_settings.py:    print(f"{ss.status()=}")
app_settings.py:        print(f"{key=} {ss.getKey(key)=} {ss._keySplit_(key)=}")
app_settings.py:    print(f"{ss.getKey(None)=}")
date_time_range_slider.py:    print(f"{main.low()=}  {main.high()=}")
filterpanel.py:        print(f"catalogSelected: {catalog_name=} {args = }  {kwargs = }")
filterpanel.py:        print(f"{t_low=} {t_high=}")
filterpanel.py:        print(f"{since=} {until=}")
filterpanel.py:        print(f"filteredCatalog: {cat=}")
range_slider.py:        # print(self._low)
range_slider.py:        # print(low_rect, high_rect)
range_slider.py:        # print(min_pos, max_pos, c)
range_slider.py:        # print(groove.x(), groove.y(), groove.width(), groove.height())
resultwindow.py:            # print("Display role:", index.row(), index.column())
resultwindow.py:        # print(f"doPager {action =}, {value =}")
resultwindow.py:        # print(f"{catalog_length=} {offset=}  {size=}")
resultwindow.py:        # print(f"{self.pageOffset()=} {self.pageSize()=}")
resultwindow.py:        # print(f"{action=} {kwargs=}")
resultwindow.py:            print(f"{model.pageOffset()=}")
resultwindow.py:        # print(f"doPageSize {value =}")
resultwindow.py:        # print(f"Displaying catalog: {self.cat.item['id']!r}")
tiledserverdialog.py:        # print(f"{url=} {url.isValid()=} {url.isRelative()=}")
utils.py:    # print(f"myLoadUi({ui_file=})")
prjemian commented 1 year ago

Add command line options for selection of logging levels:

option logging level
default logging.ERROR
-v logging.WARNING
-vv logging.INFO
-vvv logging.DEBUG
prjemian commented 1 year ago

See this SO post: https://stackoverflow.com/questions/57192387/how-to-set-logging-level-from-command-line

prjemian commented 1 year ago

Note: -v is already used as shorthand for --version.