File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55import uvicorn
66
7- from log import get_logger , resolve_log_level
7+ from log import get_logger , resolve_log_level , setup_logging
88from models .config import ServiceConfiguration
99
10- logger = get_logger (__name__ )
10+ logger = get_logger (__file__ )
1111
1212
13- def start_uvicorn (configuration : ServiceConfiguration ) -> None :
13+ def start_uvicorn (
14+ configuration : ServiceConfiguration ,
15+ log_config : dict | None = None ,
16+ ) -> None :
1417 """Start the Uvicorn server using the provided service configuration.
1518
1619 Parameters:
@@ -22,6 +25,8 @@ def start_uvicorn(configuration: ServiceConfiguration) -> None:
2225 """
2326 log_level = resolve_log_level ()
2427 logger .info ("Starting Uvicorn with log level %s" , logging .getLevelName (log_level ))
28+ if log_config is None :
29+ log_config = setup_logging ()
2530
2631 # please note:
2732 # TLS fields can be None, which means we will pass those values as None to uvicorn.run
@@ -30,6 +35,7 @@ def start_uvicorn(configuration: ServiceConfiguration) -> None:
3035 host = configuration .host ,
3136 port = configuration .port ,
3237 workers = configuration .workers ,
38+ log_config = log_config ,
3339 log_level = log_level ,
3440 ssl_keyfile = configuration .tls_config .tls_key_path ,
3541 ssl_certfile = configuration .tls_config .tls_certificate_path ,
You can’t perform that action at this time.
0 commit comments