Skip to content

Commit 8a31b8c

Browse files
committed
README.md updated
1 parent b62d3d4 commit 8a31b8c

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ with a 4 percentage point increase from the previous year.
7979
To build , run and test and more ... use magic of make help to play with this project.
8080
```shell
8181
1. make docker-build
82-
2. make docker-up
82+
2. make docker-up > alternatively > make docker-up-granian
8383
3. make docker-apply-db-migrations
8484
4. make docker-feed-database
8585
```
@@ -98,22 +98,23 @@ Next models were generated with https://github.com/agronholm/sqlacodegen
9898

9999
### Rainbow logs with rich :rainbow:
100100

101-
To deliver better user(developer) experience when watching logs with tons of information
102-
from few emitters (which are really needy on development stage) project is using [rich](https://github.com/Textualize/rich) library.
103-
Event with [rich](https://github.com/Textualize/rich) superpowers reading logs is not easy.
104-
Found [rich](https://github.com/Textualize/rich) really nice -
105-
but it took time to learn how to integrate it as logger object properly and keep it as singleton.
101+
To enhance the developer experience when viewing logs with extensive information from multiple emitters
102+
(which are particularly useful during development), this project uses the [rich](https://github.com/Textualize/rich) library.
103+
Event with the superpowers of [rich](https://github.com/Textualize/rich), reading logs can be challenging.
104+
The [rich](https://github.com/Textualize/rich) library is highly beneficial, but integrating it properly as a logger object
105+
and maintaining it as a singleton took some effort.
106106

107-
To address below needs:
108-
- it is hard to find what I am looking for even with glasses on.
109-
- don’t want to hire ELK to be able to use logs.
110-
- want to move fast enough with debugging.
107+
To address the following needs:
108+
- Difficulty in finding specific information in logs.
109+
- Avoiding the complexity of setting up an ELK stack for log management.
110+
- Speeding up the debugging process.
111111

112-
Below steps were done to integrate [rich](https://github.com/Textualize/rich) into project.
113-
1. Configure emitters with [config.ini](https://github.com/grillazz/fastapi-sqlalchemy-asyncpg/blob/main/config.ini)
114-
2. Eliminate duplicates i.e. sqlalchemy echo by separate handlers
115-
3. Keep logger as singleton pattern to avoid multiple instances
116-
4. add uvicorn parameter --log-config config.ini
112+
he following steps were taken to integrate [rich](https://github.com/Textualize/rich) into the project:
113+
1. Configure emitters using the [logging-uvicorn.json](https://github.com/grillazz/fastapi-sqlalchemy-asyncpg/blob/main/logging-uvicorn.json)
114+
or use [logging-granian.json](https://github.com/grillazz/fastapi-sqlalchemy-asyncpg/blob/main/logging-granian.json) for granian
115+
2. Eliminate duplicates, such as SQLAlchemy echo, by using separate handlers.
116+
3. Maintain the logger as a singleton to prevent multiple instances.
117+
4. Add the --log-config ./logging-uvicorn.json parameter to Uvicorn or --log-config ./logging-granian.json to Granian.
117118

118119
![sample-logs-with-rich](/static/logz.png)
119120

@@ -153,6 +154,7 @@ I've included a few of my favorites to kick things off!
153154
* [Calamine - Excel reader in Rust](https://github.com/tafia/calamine)
154155
* [Inline Snapshots - pytest plugin for inline snapshots]()
155156
* [Connection pool for asyncpg](https://magicstack.github.io/asyncpg/current/usage.html#connection-pools)
157+
* [Granian - A Rust HTTP server for Python applications](https://github.com/emmett-framework/granian)
156158

157159
<p align="right">(<a href="#readme-top">back to top</a>)</p>
158160

@@ -173,6 +175,8 @@ I've included a few of my favorites to kick things off!
173175
- **[FEB 1 2024]** bump project to Python 3.12 :fast_forward:
174176
- **[MAR 15 2024]** add polars and calamine to project :heart_eyes_cat:
175177
- **[JUN 8 2024]** implement asyncpg connection pool :fast_forward:
178+
- **[AUG 17 2024]** granian use case implemented with docker compose and rich logger :fast_forward:
179+
176180
<p align="right">(<a href="#readme-top">back to top</a>)</p>
177181

178182

@@ -191,21 +195,21 @@ I've included a few of my favorites to kick things off!
191195
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
192196
[linkedin-url]: https://www.linkedin.com/in/python-has-powers/
193197

194-
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.111.0-009485?style=for-the-badge&logo=fastapi&logoColor=white
198+
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.112.1-009485?style=for-the-badge&logo=fastapi&logoColor=white
195199
[fastapi-url]: https://fastapi.tiangolo.com/
196200
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.8.2-e92063?style=for-the-badge&logo=pydantic&logoColor=white
197201
[pydantic-url]: https://docs.pydantic.dev/latest/
198-
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.31-bb0000?color=bb0000&style=for-the-badge
202+
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.32-bb0000?color=bb0000&style=for-the-badge
199203
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
200-
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.30.1-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
204+
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.30.6-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
201205
[uvicorn-url]: https://www.uvicorn.org/
202206
[asyncpg.github.io]: https://img.shields.io/badge/asyncpg-0.29.0-2e6fce?style=for-the-badge&logo=postgresql&logoColor=white
203207
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
204-
[pytest.org]: https://img.shields.io/badge/pytest-8.2.2-fff?style=for-the-badge&logo=pytest&logoColor=white
208+
[pytest.org]: https://img.shields.io/badge/pytest-8.3.2-fff?style=for-the-badge&logo=pytest&logoColor=white
205209
[pytest-url]: https://docs.pytest.org/en/6.2.x/
206210
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.13.2-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
207211
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
208212
[rich.readthedocs.io]: https://img.shields.io/badge/rich-13.7.1-009485?style=for-the-badge&logo=rich&logoColor=white
209213
[rich-url]: https://rich.readthedocs.io/en/latest/
210-
[redis.io]: https://img.shields.io/badge/redis-5.0.7-dc382d?style=for-the-badge&logo=redis&logoColor=white
214+
[redis.io]: https://img.shields.io/badge/redis-5.0.8-dc382d?style=for-the-badge&logo=redis&logoColor=white
211215
[redis-url]: https://redis.io/

0 commit comments

Comments
 (0)