feat: add cache and logging
This commit is contained in:
34
weather/logging.yaml
Normal file
34
weather/logging.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
version: 1
|
||||
disable_existing_loggers: False
|
||||
formatters:
|
||||
default:
|
||||
# "()": uvicorn.logging.DefaultFormatter
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
access:
|
||||
# "()": uvicorn.logging.AccessFormatter
|
||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
handlers:
|
||||
default:
|
||||
formatter: default
|
||||
class: logging.StreamHandler
|
||||
stream: ext://sys.stderr
|
||||
access:
|
||||
formatter: access
|
||||
class: logging.StreamHandler
|
||||
stream: ext://sys.stdout
|
||||
loggers:
|
||||
uvicorn.error:
|
||||
level: INFO
|
||||
handlers:
|
||||
- default
|
||||
propagate: no
|
||||
uvicorn.access:
|
||||
level: INFO
|
||||
handlers:
|
||||
- access
|
||||
propagate: no
|
||||
root:
|
||||
level: INFO
|
||||
handlers:
|
||||
- default
|
||||
propagate: no
|
||||
@@ -1,4 +1,5 @@
|
||||
from os import environ
|
||||
from pathlib import Path
|
||||
|
||||
import uvicorn
|
||||
|
||||
@@ -9,4 +10,10 @@ app = build_app(GismeteoApi())
|
||||
|
||||
|
||||
def run():
|
||||
uvicorn.run("weather.main:app", host="0.0.0.0", port=8000, reload="DEBUG" in environ)
|
||||
uvicorn.run(
|
||||
"weather.main:app",
|
||||
host="0.0.0.0",
|
||||
port=8000,
|
||||
log_config=str(Path(__file__).parent / "logging.yaml"),
|
||||
reload="DEBUG" in environ,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user