BCDA-APS / gemviz

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

print() --> logger.debug (mostly) #161

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

command-line help now shows:

$ gemviz -h
usage: gemviz [-h] [--log {critical,fatal,error,warn,warning,info,debug,notset}] [-v]

gemviz: Python Qt5 application to visualize Bluesky data from tiled server.

options:
  -h, --help            show this help message and exit
  --log {critical,fatal,error,warn,warning,info,debug,notset}
                        Provide logging level. Example '--log debug'. Default level: 'warning'
  -v, --version         show program's version number and exit
prjemian commented 1 year ago

The DEBUG level is very noisy. Lots of Qt debug messages. Here is the info level:

$ gemviz --log info
INFO:gemviz.app:Logging level: info
INFO:gemviz.mainwindow:Status: Application started ...
INFO:gemviz.mainwindow:Status: selected tiled server_uri='http://localhost:8020'
INFO:httpx:HTTP Request: GET http://localhost:8020/api/v1/ "HTTP/1.1 400 Bad Request"
INFO:gemviz.mainwindow:Status: Error for server_uri='http://localhost:8020': 400: Python Tiled client reports version 0.1.0a96. Version 0.1.0a104 or higher is needed to communicate with this Tiled server. http://localhost:8020/api/v1/
INFO:gemviz.mainwindow:Status: Application quitting ...
prjemian commented 1 year ago

Wow, even the info level is noisy, noting each GET from the server. Here are just two lines:

INFO:httpx:HTTP Request: GET http://localhost:8020/api/v1/search/training?filter%5Blookup%5D%5Bcondition%5D%5Bkey%5D=7a7700b3-7641-4bdc-ac2c-8dee241f6b41&filter%5Bcomparison%5D%5Bcondition%5D%5Boperator%5D=ge&filter%5Bcomparison%5D%5Bcondition%5D%5Boperator%5D=le&filter%5Bcomparison%5D%5Bcondition%5D%5Bkey%5D=time&filter%5Bcomparison%5D%5Bcondition%5D%5Bkey%5D=time&filter%5Bcomparison%5D%5Bcondition%5D%5Bvalue%5D=1618203600.0&filter%5Bcomparison%5D%5Bcondition%5D%5Bvalue%5D=1694025296.03235&sort=time "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET http://localhost:8020/api/v1/search/training?filter%5Blookup%5D%5Bcondition%5D%5Bkey%5D=7a7700b3-7641-4bdc-ac2c-8dee241f6b41&filter%5Bcomparison%5D%5Bcondition%5D%5Boperator%5D=ge&filter%5Bcomparison%5D%5Bcondition%5D%5Boperator%5D=le&filter%5Bcomparison%5D%5Bcondition%5D%5Bkey%5D=time&filter%5Bcomparison%5D%5Bcondition%5D%5Bkey%5D=time&filter%5Bcomparison%5D%5Bcondition%5D%5Bvalue%5D=1618203600.0&filter%5Bcomparison%5D%5Bcondition%5D%5Bvalue%5D=1694025296.03235&sort=time "HTTP/1.1 200 OK"
prjemian commented 1 year ago

With --log info and piping the output into a log file, this analysis:

(tiled) prjemian@arf:~/.../BCDA-APS/gemviz$ grep -v httpx /tmp/log.txt 
INFO:gemviz.app:Logging level: info
INFO:gemviz.mainwindow:Status: Application started ...
INFO:gemviz.mainwindow:Status: selected tiled server_uri='http://localhost:8020'
INFO:gemviz.mainwindow:Status: Selected catalog 'training'.
INFO:gemviz.mainwindow:Status: catalog 'training' is 'CatalogOfBlueskyRuns, v1'
INFO:gemviz.mainwindow:Status: None
INFO:gemviz.mainwindow:Status: 1-5 of 8857 runs
INFO:gemviz.mainwindow:Status: 1-5 of 8857 runs
INFO:gemviz.mainwindow:Status: Application quitting ...
(tiled) prjemian@arf:~/.../BCDA-APS/gemviz$ grep httpx /tmp/log.txt | wc -l
574
prjemian commented 1 year ago

Ok, logging at info or debug is quieter now.

prjemian commented 1 year ago

@rodolakis Ready for review.