Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
python-logfmter
Using the stdlib logging module and without changing a single logging call, logfmter supports global (first and third party) logfmt structured logging.
-
django-guid
Inject an ID into every log message from a Django request. ASGI compatible, integrates with Sentry, and works with Celery
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
A very good post on creating good log contexts.
For powerful log channeling and notifications to Telegram, Slack, etc. there is this Python package:
https://pypi.org/project/notifiers/
I also created a logging handler for Discord, where one can get notifications on errors to a private channel:
https://github.com/tradingstrategy-ai/python-logging-discord...
A very good post on creating good log contexts.
For powerful log channeling and notifications to Telegram, Slack, etc. there is this Python package:
https://pypi.org/project/notifiers/
I also created a logging handler for Discord, where one can get notifications on errors to a private channel:
https://github.com/tradingstrategy-ai/python-logging-discord...
Using the official CLI (aws logs get-log-events) or https://github.com/jorgebastida/awslogs is pretty close to SSH-ing and grepping.
Honestly, I like to keep the logger as decoupled and minimalist as possible. There’s https://vector.dev which can basically ship your logs from source A to destination B. Separation of concerns makes things much more easier.
You always need some boilerplate to get structlog working. I always use this (author) to have the needed defaults https://github.com/peakiq/logma.
https://github.com/jteppinette/python-logfmter
I made this library to make global structured logging in Python super easy.
You should try the loguru library. I was able to roll a rolling-upload-to-s3 adapter in under an hour. Switching to json logs is one bool flag away. Plus it's gorgeous
https://github.com/Delgan/loguru
Also iirc s3's "file-like interface" does not actually obey the file protocol, which is obnoxious.
I'd just like to plug my lib, pygogo (https://github.com/reubano/pygogo). Here's a structured log example taken from the docs.
import pygogo as gogo
As there are real advantages to providing a template and object args separately, this is a bit of a shame since it pushes people to use pre-formatted strings without any args instead.
I fixed this for myself by writing bracelogger[0]. If this is a pain point for you too, you might find it useful.
[0]: https://github.com/pR0Ps/bracelogger
Related posts
- Build and Deploy a URL Shortener using Django REST Framework and Managed Postgres
-
Loguru VS polog - a user suggested alternative
2 projects | 9 Dec 2023
- Resource for Django's internal structure
- a few comments and questions about loguru - the most popular 3rd party logging module for Python
- Open Source Django Projects for Study