Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use module-specific logger in library code instead of root logger #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

majiang
Copy link

@majiang majiang commented Aug 14, 2020

This pull request is to comply with Advanced Logging Tutorial:

A good convention to use when naming loggers is to use a module-level logger, in each module which uses logging, named as follows:

logger = logging.getLogger(__name__)

This pull request is also almost identical to #94 which I'm not sure why was closed.

@majiang majiang force-pushed the develop branch 2 times, most recently from 47587c1 to 91dcc30 Compare August 17, 2020 02:41
@delewis13
Copy link

+1 on this, using this module is adding a stream handler to my root level logger, which subsequently causes all my logging statements in the rest of my application to output multiple lines.

@majiang
Copy link
Author

majiang commented Oct 2, 2020

Hi Splunk team, do you have any comments, thoughts or ideas about failing CI?

@RCoff
Copy link

RCoff commented Apr 7, 2021

I definitely need this. The logs from 'binding.py' are unnecessary for me and only serve to clog up my Splunk index.

@ashah-splunk
Copy link
Contributor

ashah-splunk commented Mar 30, 2022

@majiang as per your suggestion, we have added module specific logger along with an utility to enable loggers for different levels as well. Please refer the README. The changes are available in the latest release 1.6.19

@majiang
Copy link
Author

majiang commented Mar 30, 2022

Thanks! It's #437, for reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants