Skip to content
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

Remove setting of the _root_ logger level as this is best done by the… #86

Merged
merged 1 commit into from
May 23, 2024

Conversation

erwinscholtens
Copy link
Contributor

As I understand it: The root logger should not be changed by a library. The reason for this is that now anyone using Mistral Client will have their root logger changed and log statements in the calling code will be affected (both by the level and the formatting). This behavior can be seen by the following snippet:

import logging

# from mistralai.client import MistralClient

logger = logging.getLogger(__name__)
logger.warning("hi")

The logger warning will only be displayed if the second line is commented, because otherwise the log level will be set to ERROR.

The suggested solution is to leave the formatting and level to the end user (calling code) and remove it from here.

@fuegoio
Copy link
Collaborator

fuegoio commented May 23, 2024

Thank you for your contribution your are right :)

@fuegoio fuegoio merged commit d469f2a into mistralai:main May 23, 2024
wilsonsilva added a commit to wilsonsilva/mistral that referenced this pull request May 23, 2024
wilsonsilva added a commit to wilsonsilva/mistral that referenced this pull request May 23, 2024
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.

None yet

3 participants