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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default log_config on uvicorn.run() #1541

Merged
merged 1 commit into from Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion uvicorn/main.py
Expand Up @@ -478,7 +478,7 @@ def run(
reload_delay: float = 0.25,
workers: typing.Optional[int] = None,
env_file: typing.Optional[str] = None,
log_config: typing.Optional[typing.Union[dict, str]] = None,
log_config: typing.Optional[typing.Union[dict, str]] = LOGGING_CONFIG,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log_config: typing.Optional[typing.Union[dict, str]] = LOGGING_CONFIG,
log_config: typing.Optional[typing.Union[typing.Mapping[str, Any], str]] = LOGGING_CONFIG,

At least this way we'll get an error from the type checker if we try to mutate the default argument.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge #1539 after this PR.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it wouldn't make any difference for here...

log_level: typing.Optional[str] = None,
access_log: bool = True,
proxy_headers: bool = True,
Expand Down