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]                                      
                    INFO     [localdb][<module>] mqdbt path: /usr/local/venv/bin/mqdbt [MainThread]                                      
                    INFO     [localdb][<module>] mqat path: /usr/local/venv/bin/mqat [MainThread]                                        
2024-03-28 05:03:58 INFO     [localdb][<module>] This LocalDB server runs with: [MainThread]                                             
                    INFO     [localdb][<module>]   * itkdb 0.5.0 [MainThread]                                                            
                    INFO     [localdb][<module>]   * module-qc-database-tools 2.2.6 [MainThread]                                         
                    INFO     [localdb][<module>]   * module-qc-analysis-tools 2.2.3 [MainThread]                                         
2024-03-28 05:03:59 INFO     [localdb][<module>] Viewer Application URL: [MainThread]                           
 * 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 =
                             MODULE/POST_PARYLENE_COLD [GET /component]
                    INFO     [localdb][show_component] This Session Id: 64d29aa336685800412599ef [GET /component]                     
                    INFO     [localdb][show_component] {'code': '',                                                                   
                              '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.


Edited by Giordon Holtsberg Stark

Merge request reports