JSON logs in Python apps - with FastAPI & python-json-logger!

Опубликовано: 08 Октябрь 2024
на канале: Better Stack
2,575
98

In this video, we'll look at how to output logs in JSON format from Python applications.

We will demonstrate this with the "python-json-logger" package, and will also show how to centralize our logs by sending them to Better Stack from our application code.

► RELATED GUIDES
10 Best Practices for Logging in Python:
https://betterstack.com/community/gui...

Logging in Python: A Comparison of the Top 6 Libraries:
https://betterstack.com/community/gui...

How to Get Started with Logging in Django: https://betterstack.com/community/gui...

► HACKING SCALE NEWSLETTER
https://newsletter.betterstack.com/

► READ MORE
More about Better Stack: https://betterstack.com/
Community pages: https://betterstack.com/community/

► STAY TUNED
GitHub: https://github.com/BetterStackHQ
Twitter:   / betterstackhq  
LinkedIn:   / betterstack  
Instagram:   / betterstackhq  
TikTok:   / betterstack  

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:47 python-json-logger intro
01:16 Starter Project
02:39 Creating python environment
03:49 Creating FastAPI handler
09:27 Outputting logs in JSON format with python-json-logger
11:29 Sending Python logs to Better Stack
15:44 Creating FastAPI handler with a path parameter

#logging #python #pythonprogramming