sosia-dev / sosia

Sosia: Automatic author matching in Scopus on-line
https://sosia.readthedocs.io/
MIT License
11 stars 3 forks source link

#14 Use context manager to log scopus queries #43

Closed nils-herrmann closed 1 week ago

nils-herrmann commented 1 week ago

Let's use a context manager to log scopus (and any exception). The context manager executes the scopus query in a try-except manner which enables us to always log and detect any exception.

The resulting logs look as follows:

24-11-20 15:25:01 - DEBUG: 
    - Scopus API: Author Search
    - View: Default
    - Query: AU-ID(55208373700)
    - Exception: None
    - Results: 1
24-11-20 15:25:01 - DEBUG: 
    - Scopus API: Scopus Search
    - View: COMPLETE
    - Query: SOURCE-ID(11600153421) AND PUBYEAR IS 2011
    - Exception: None
    - Results: 62
24-11-20 15:25:01 - DEBUG: 
Michael-E-Rose commented 1 week ago

Now that the log entry layout changes, could you please update the documentation: https://github.com/sosia-dev/sosia/blob/master/docs/tutorial/debug.rst