Skip to content

Don't call logging.basicConfig() in library code - #22

Merged
leandrotoledo merged 1 commit into
python-telegram-bot:masterfrom
wjt:logging
Aug 8, 2015
Merged

Don't call logging.basicConfig() in library code#22
leandrotoledo merged 1 commit into
python-telegram-bot:masterfrom
wjt:logging

Conversation

@wjt

@wjt wjt commented Jul 30, 2015

Copy link
Copy Markdown
Contributor

Logging should be configured by the application, not by libraries it
uses. Libraries should just get a logger and log to it.

Fixes #21

For another concrete problem caused by calling logging.basicConfig() in the library, import telegram changes the meaning of the following program:

import logging
import telegram

log = logging.getLogger(__name__)

if __name__ == '__main__':
    logging.basicConfig(level='DEBUG')
    log.debug("this should be printed, but will not be "
        "unless you comment out 'import telegram'")

Logging should be configured by the application, not by libraries it
uses. Libraries should just get a logger and log to it.

Fixes python-telegram-bot#21
@franciscod

Copy link
Copy Markdown
Contributor

@leandrotoledo please merge this :)

leandrotoledo added a commit that referenced this pull request Aug 8, 2015
Don't call logging.basicConfig() in library code
@leandrotoledo
leandrotoledo merged commit a91c158 into python-telegram-bot:master Aug 8, 2015
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable logging

3 participants