Skip to content

feat: clean up logging

Giordon Holtsberg Stark requested to merge feat/fixLogging into devel-2.2

This harmonizes logging by dropping coloredlogs in favor of RichHandler. Resolves #71 (closed) .

This sets up the logs with quite a bit more information which is easier to debug in the future, such as setting Flask request threads that get spawned to have names corresponding to the request that came in, as well as the name of the function being called, and the file/line involved too.

2024-03-28 05:03:56 INFO     [localdb][<module>] itkdb path: /usr/local/venv/bin/itkdb [MainThread]                                                common.py:257
                    INFO     [localdb][<module>] mqdbt path: /usr/local/venv/bin/mqdbt [MainThread]                                                common.py:257
                    INFO     [localdb][<module>] mqat path: /usr/local/venv/bin/mqat [MainThread]                                                  common.py:257
2024-03-28 05:03:58 INFO     [localdb][<module>] This LocalDB server runs with: [MainThread]                                                       common.py:306
                    INFO     [localdb][<module>]   * itkdb 0.5.0 [MainThread]                                                                      common.py:307
                    INFO     [localdb][<module>]   * module-qc-database-tools 2.2.6 [MainThread]                                                   common.py:308
                    INFO     [localdb][<module>]   * module-qc-analysis-tools 2.2.3 [MainThread]                                                   common.py:309
2024-03-28 05:03:59 INFO     [localdb][<module>] Viewer Application URL: http://0.0.0.0:5000/localdb/ [MainThread]                                     app.py:77
 * Serving Flask app 'app'
 * Debug mode: off
2024-03-28 05:04:09 INFO     [localdb][__init__] ScanCheckoutManager.__init__(): component_sn = 20UPGM22110394, module_sn = None, stage_name =  checkouter.py:61
                             MODULE/POST_PARYLENE_COLD [GET /component]
                    INFO     [localdb][show_component] This Session Id: 64d29aa336685800412599ef [GET /component]                               component.py:199
                    INFO     [localdb][show_component] {'code': '',                                                                             component.py:215
                              'collection': 'component',
                              'expandPlots': False,
                              'logged_in': False,
                              'regeneratePlots': False,
                              'runId': None,
                              'test': '',
                              'this': '64d29aa336685800412599ef',
                              'timezone': 'Etc/UTC',
                              'unit': 'module',
                              'uuid': '10847e73-f213-4652-9a28-b1e17b9f2f80'} [GET /component]

See screenshot below for colored output. This does set the width at 160 characters, which is probably reasonably for printing to the screen.

Screenshot_2024-03-27_at_10.07.23_PM

Edited by Giordon Holtsberg Stark

Merge request reports