petermr / pygetpapers

a Python version of getpapers
Apache License 2.0
78 stars 9 forks source link

Log levels and messages #5

Closed petermr closed 3 years ago

petermr commented 3 years ago

getpapers has:

-l, --loglevel <level>    amount of information to log (silent, verbose, info*, data, warn, error, or debug)

The current pygetpapers is verbose, relatively uninformative, and cannot be altered. Most of it would be debug D or trace T. My comments are added as PMR>

pygetpapers -q aardvark -k 2
*/Building the Query*/
PMR> how is this "building"? Suggest:
submitting RESTful query (I)
*/Making the Request to get all hits*/
PMR> unclear
*/Got the Content */
PMR> "the content" is too vague (D)
Time elapsed: 5.338146924972534 
PMR> format to at most i decimal (T)
Reading Dictionary for paper 1
PMR> What Dictionary? This will confuse everyone except developers (T)
Author list not found for paper 1
PMR> This seems important. Maybe (W)
Wrote the important Attrutes to a dictionary
PMR> unclear (and misspelt)
Reading Dictionary for paper 2
Wrote the important Attrutes to a dictionary
*/Writing the xml papers to memory*/
PMR> memory or disk? If the former this is (T); if the latter "saving xml to per-document directories (CTrees) (D)
*/Making the Request to get full text xml*/
PMR> RESTful request for fulltext.xml (D)
*/Done*/
PMR> unclear and confusing
*/Wrote the xml paper 1 at /Users/pm286/projects/openDiagram/physchem/python/papers/PMC7833733/fulltext.xml/
PMR>Split this:
Saving XML files to /Users/pm286/projects/openDiagram/physchem/python/papers/*/fulltext.xml
Wrote PMC12346
Wrote PMC23456
(This could also use a progress bar like getpapers)
Time elapsed: 0.7823638916015625
*/Updating the pickle*/ 
PMR> (D)
*/Making the Request to get full text xml*/
*/Done*/
*/Wrote the xml paper 2 at /Users/pm286/projects/openDiagram/physchem/python/papers/PMC7887608/fulltext.xml/
Time elapsed: 0.38059282302856445
*/Updating the pickle*/ 
ayush4921 commented 3 years ago

I agree. I will first fix the existing logs and then add log levels. Adding log levels in python would mean something like adding addtributes to every function and then using conditional statements to display the logs. I will keep this as medium priority.

ayush4921 commented 3 years ago

Found a better way.. Will implement using python's logging module