python-gitlab icon indicating copy to clipboard operation
python-gitlab copied to clipboard

chore: add bare-minimum logging support

Open JohnVillalovos opened this issue 3 years ago • 5 comments

Follow the Python documentation guidelines for "Configuring Logging for a Library" [1]

Which is adding these two lines: import logging logging.getLogger(name).addHandler(logging.NullHandler())

Setup a very basic usage of logging in gitlab/client.py

By using the NullHandler it means that by default any log messages output will not be displayed. It is up to the client application to do a logging.basicConfig() call to get log messages to display.

[1] https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library Related: #2080

JohnVillalovos avatar Jul 30 '22 20:07 JohnVillalovos

Codecov Report

Merging #2204 (b476afe) into main (7a8a862) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2204   +/-   ##
=======================================
  Coverage   96.18%   96.18%           
=======================================
  Files          87       88    +1     
  Lines        5683     5692    +9     
=======================================
+ Hits         5466     5475    +9     
  Misses        217      217           
Flag Coverage Δ
api_func_v4 82.53% <90.00%> (+0.02%) :arrow_up:
cli_func_v4 83.01% <90.00%> (+0.02%) :arrow_up:
unit 87.66% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/__init__.py 100.00% <100.00%> (ø)
gitlab/_logging.py 100.00% <100.00%> (ø)
gitlab/client.py 98.80% <100.00%> (+<0.01%) :arrow_up:

codecov-commenter avatar Jul 30 '22 20:07 codecov-commenter

I think it worth adding this feature to the features list mentioned in the README

lmilbaum avatar Nov 03 '22 06:11 lmilbaum

Integration tests would probably help us figure out what actually happens when the library is being used by an application. More than that, it will provide us the confidence that what happens is exactly what we expect it to do. WDYT?

lmilbaum avatar Nov 03 '22 07:11 lmilbaum