fastapi-logging-0.1.1
توضیحات
Logging Wrapper for fastapi with Cloud Logging
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | fastapi-logging-0.1.1 |
| نام | fastapi-logging |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | SantoLabs |
| ایمیل نویسنده | santolabs@santodigital.com.br |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/fastapi-logging/ |
| مجوز | - |
# Wrapper para trabalhar com a API do Cloud Logging
## Procedimento para upload no Pypi
### Pré requisitos
Instalar pacotes python
`python3 -m pip install --upgrade setuptools build wheel twine`
### Build e enviar ao PYPI
`python3 -m build`
`python3 -m twine upload dist/*`
### Instalar o pacote no projeto
`pip install fastapi-logging`
## Utilização da biblioteca
Essa biblioteca espera que você passe o schema dos dados da tabela
Aconselho criar um arquivo de schema.py ou model.py onde seja definido a estrutura de dados da tabela.
### Instanciar o Middleware
Com o schema definido, você deve instanciar um classe
```python
from starlette.middleware import Middleware
from fastapi.middleware.cors import CORSMiddleware
from starlette_context.middleware.raw_middleware import RawContextMiddleware
from fastapi_logging.logging import LogMidddleware
from fastapi_logging.logging import logging
from fastapi_logging.logging import TracePlugin
from starlette_context import context, plugins
middlewares = [
Middleware(
RawContextMiddleware,
plugins=(
plugins.CorrelationIdPlugin(),
TracePlugin(),
plugins.RequestIdPlugin(),
),
),
Middleware(LogMidddleware),
Middleware(CORSMiddleware,
allow_origins=BACKEND_CORS_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],)
]
app = FastAPI(
title='Iris Typification',
openapi_url="/api/v1/openapi.json",
middleware=middlewares
)
```
### Principais operações
Usando a classe, você pode executar algumas operações para auxiliar no densenvolvimento
Logging
`logging.info({"key": "value"})`
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl fastapi-logging-0.1.1:
pip install fastapi-logging-0.1.1.whl
نصب پکیج tar.gz fastapi-logging-0.1.1:
pip install fastapi-logging-0.1.1.tar.gz