There is a library in stdlib that is ideal for this, --debug should print all the debug-level logs: https://pkg.go.dev/log/slog