Skip to content

Commit

Permalink
Fix type hints for log_config (#1539)
Browse files Browse the repository at this point in the history
* Fix type hints for log_config

* Update uvicorn/main.py

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
  • Loading branch information
wch and Kludex committed Oct 29, 2022
1 parent 2ce9c18 commit 722b98f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions uvicorn/config.py
Expand Up @@ -10,6 +10,7 @@
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Callable,
Dict,
Expand Down Expand Up @@ -91,7 +92,7 @@
SSL_PROTOCOL_VERSION: int = ssl.PROTOCOL_TLS_SERVER


LOGGING_CONFIG: dict = {
LOGGING_CONFIG: Dict[str, Any] = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
Expand Down Expand Up @@ -222,7 +223,7 @@ def __init__(
ws_per_message_deflate: Optional[bool] = True,
lifespan: LifespanType = "auto",
env_file: Optional[Union[str, os.PathLike]] = None,
log_config: Optional[Union[dict, str]] = LOGGING_CONFIG,
log_config: Optional[Union[Dict[str, Any], str]] = LOGGING_CONFIG,
log_level: Optional[Union[str, int]] = None,
access_log: bool = True,
use_colors: Optional[bool] = None,
Expand Down
4 changes: 3 additions & 1 deletion uvicorn/main.py
Expand Up @@ -478,7 +478,9 @@ 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]] = LOGGING_CONFIG,
log_config: typing.Optional[
typing.Union[typing.Dict[str, typing.Any], str]
] = LOGGING_CONFIG,
log_level: typing.Optional[str] = None,
access_log: bool = True,
proxy_headers: bool = True,
Expand Down

0 comments on commit 722b98f

Please sign in to comment.