NSLS-II / nslsii

NSLS-II related devices
BSD 3-Clause "New" or "Revised" License
10 stars 21 forks source link

set propagate = False on loggers #112

Closed jklynch closed 3 years ago

jklynch commented 3 years ago

This PR proposes a solution to the problem of users being overwhelmed with log output from the loggers configured in nslsii.configure_base when they configure their own root logger.

By setting getLogger(["bluesky", "caproto", "ophyd", "nslsii"]).propagate = False, log messages sent to those loggers will not propagate to higher-level loggers such as a root logger. This will allow our logging to proceed without disturbing users who configure a root logger to print their log messages to the console.

The documentation for nslsii.configure_bluesky_logging has been updated to reflect this change and to direct users to set getLogger(...).propagate = True in their code if they want log messages to propagate from our loggers to higher-level loggers.

codecov-io commented 3 years ago

Codecov Report

Merging #112 (21ef1e1) into master (60a8e75) will increase coverage by 1.08%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
+ Coverage   57.07%   58.16%   +1.08%     
==========================================
  Files          13       13              
  Lines         904      937      +33     
==========================================
+ Hits          516      545      +29     
- Misses        388      392       +4     
Impacted Files Coverage Δ
nslsii/__init__.py 36.91% <100.00%> (-1.16%) :arrow_down:
nslsii/tests/test_logutils.py 98.80% <100.00%> (+0.34%) :arrow_up:
nslsii/tests/test_kafka_publisher.py 86.95% <0.00%> (-5.80%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 60a8e75...21ef1e1. Read the comment docs.