@@ -100,6 +100,7 @@ def _run(
100100 entrypoint : Union [str , None ] = None ,
101101 proxy_headers : bool = False ,
102102 forwarded_allow_ips : Union [str , None ] = None ,
103+ log_config : Union [Path , None ] = None ,
103104) -> None :
104105 with get_rich_toolkit () as toolkit :
105106 server_type = "development" if command == "dev" else "production"
@@ -186,7 +187,7 @@ def _run(
186187 root_path = root_path ,
187188 proxy_headers = proxy_headers ,
188189 forwarded_allow_ips = forwarded_allow_ips ,
189- log_config = get_uvicorn_log_config (),
190+ log_config = get_uvicorn_log_config () if not log_config else str ( log_config ) ,
190191 )
191192
192193
@@ -250,6 +251,12 @@ def dev(
250251 help = "Comma separated list of IP Addresses to trust with proxy headers. The literal '*' means trust everything."
251252 ),
252253 ] = None ,
254+ log_config : Annotated [
255+ Union [Path , None ],
256+ typer .Option (
257+ help = "Logging configuration file. Supported formats: .ini, .json, .yaml. be tried."
258+ ),
259+ ] = None ,
253260) -> Any :
254261 """
255262 Run a [bold]FastAPI[/bold] app in [yellow]development[/yellow] mode. 🧪
@@ -287,6 +294,7 @@ def dev(
287294 command = "dev" ,
288295 proxy_headers = proxy_headers ,
289296 forwarded_allow_ips = forwarded_allow_ips ,
297+ log_config = log_config ,
290298 )
291299
292300
@@ -356,6 +364,12 @@ def run(
356364 help = "Comma separated list of IP Addresses to trust with proxy headers. The literal '*' means trust everything."
357365 ),
358366 ] = None ,
367+ log_config : Annotated [
368+ Union [Path , None ],
369+ typer .Option (
370+ help = "Logging configuration file. Supported formats: .ini, .json, .yaml."
371+ ),
372+ ] = None ,
359373) -> Any :
360374 """
361375 Run a [bold]FastAPI[/bold] app in [green]production[/green] mode. 🚀
@@ -394,6 +408,7 @@ def run(
394408 command = "run" ,
395409 proxy_headers = proxy_headers ,
396410 forwarded_allow_ips = forwarded_allow_ips ,
411+ log_config = log_config ,
397412 )
398413
399414
0 commit comments