Grokking Advanced Go
Vote

0% completed

​

Structured Logging with slog

Order 1001 was charged twice, according to a customer, and an engineer searches the logs for that order. The service has written lines such as saved order 1001 for Ada, order=1001 saved, and charge ok (1001), because three people wrote those calls to log.Printf. A search for 1001 also returns every order that cost 1001 cents.

The information was in the logs, but it was inside free text that only a person can read reliably. A log line whose fields have names and types (a structured log) solves this, because a tool can then ask for every line where order_id equals 1001

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content