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

Using named logger instead of root logger #187

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yp05327
Copy link

@yp05327 yp05327 commented Jan 24, 2025

Close: #183

Try to avoid breaking the existing config options, for providing a default useful settings for user.

Outputs:
image

Then you can config the logger in your app:

# change the global log format
logger = logging.getLogger()
# add a console handler, like what realtimestt did in the __init__
formatter = logging.Formatter(fmt="xxxxx")
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
# you can also output all logs from your app to a file

# you can also config the logs from realtimestt or other libs
logger = logging.getLogger("realtimestt")
# e.g. change the log level
logger.setLevel(logging.WARNING)
....

@KoljaB
Copy link
Owner

KoljaB commented Jan 26, 2025

Thanks a lot, I'll look into that soon. I have a busy week, will prob take me until weekend, thx again.

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.

How to config user logging?
2 participants