Skip to content

Emit all logs as JSON for logs-ingester compatibility - #35

Merged
matteogastaldello merged 1 commit into
mainfrom
logs-standardization
Jun 10, 2026
Merged

Emit all logs as JSON for logs-ingester compatibility#35
matteogastaldello merged 1 commit into
mainfrom
logs-standardization

Conversation

@matteogastaldello

Copy link
Copy Markdown
Contributor

This pull request updates the logging approach in main.go to use the structured logger (slog) instead of the standard library's log package, and improves error reporting for the pprof and main HTTP servers.

Logging improvements:

  • Replaced the import of the standard log package with log/slog and removed all usage of log.Println, switching to the structured logger for consistency and better log formatting.
  • Updated the pprof server goroutine to log errors using log.Error with structured fields, instead of printing them directly.
  • Improved error logging for the main HTTP server by using structured logging with address and error fields, instead of formatting them into a string.Route pprof server errors and the server listen error through the slog JSON logger instead of stdlib log/printf-style calls, so every emitted line is a valid JSON object.

Route pprof server errors and the server listen error through the slog
JSON logger instead of stdlib log/printf-style calls, so every emitted
line is a valid JSON object.
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main.go 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@matteogastaldello
matteogastaldello merged commit 9a08d3d into main Jun 10, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant