this post was submitted on 18 Mar 2024
83 points (100.0% liked)

Python

6287 readers
8 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

If you care about performance, you may want to avoid CSV files. But since our data sources are often like our family, we can't make a choice, we'll see in this blog post how to process a CSV file as fast as possible.

you are viewing a single comment's thread
view the rest of the comments
[–] NostraDavid 6 points 7 months ago

What’s even the “gold standard” for logging stuff I guess?

structlog. Or just Structured Logging in general.

Don't do:

logging.info(f"{something} happened!")

But do

logging.info("thing-happened", thing=something)

Why? Your event will become a category, which means it's easily searchable/findable, you can output either human-readable stuff (the typical {date}, {loglevel}, {event}) or just straight up JSONL (a JSON object/dict per line). If you have JSON logs you can use jq to query/filter/manipulate your logs, if you have something like ELK, you can insert your logs there and create dashboards.

It's amazing - though it may break your brain initially.