Describe the bug
The --debug / -d flag is registered in the CLI and shows up in --help, but initLogger never reads it. The log handler is hardcoded to slog.LevelInfo regardless of whether --debug is passed.
All 13 Debug() calls across setup/match.go, setup/find.go, instrument/toolexec.go, and instrument/match.go are silently filtered out. There's no way to enable debug output from the CLI.
Additionally, all log output (including debug) only goes to debug.log in the work directory — even if the flag worked, a user would have to dig through a temp directory to see it.
To Reproduce
otelc --debug go build ./...
# vs
otelc go build ./...
# identical behavior — debug flag has no effect
initLogger at tool/cmd/main.go:121 hardcodes the level:
handler := slog.NewTextHandler(writer, &slog.HandlerOptions{
Level: slog.LevelInfo, // never changes, --debug is not read
})
The flag has actually never worked — it was originally introduced in #50 as "-debug" (extra dash, would render as ---debug). #281 fixed the typo but didn't catch that it was never wired to the logger.
Expected behavior
otelc --debug should set the logger to slog.LevelDebug so existing Debug() calls actually produce output. Debug output should also be teed to stderr so it's visible in the terminal, consistent with how go build -x and other Go toolchain tools surface verbose output.
Additional context
Stumbled across this while looking at CLI output behavior. All the debug instrumentation is already written — rule source resolution, CGO mappings, matched rule sets, import additions — it's just unreachable.
I can open a PR shortly with the fix.
Describe the bug
The
--debug/-dflag is registered in the CLI and shows up in--help, butinitLoggernever reads it. The log handler is hardcoded toslog.LevelInforegardless of whether--debugis passed.All 13
Debug()calls acrosssetup/match.go,setup/find.go,instrument/toolexec.go, andinstrument/match.goare silently filtered out. There's no way to enable debug output from the CLI.Additionally, all log output (including debug) only goes to
debug.login the work directory — even if the flag worked, a user would have to dig through a temp directory to see it.To Reproduce
initLoggerattool/cmd/main.go:121hardcodes the level:The flag has actually never worked — it was originally introduced in #50 as
"-debug"(extra dash, would render as---debug). #281 fixed the typo but didn't catch that it was never wired to the logger.Expected behavior
otelc --debugshould set the logger toslog.LevelDebugso existingDebug()calls actually produce output. Debug output should also be teed to stderr so it's visible in the terminal, consistent with howgo build -xand other Go toolchain tools surface verbose output.Additional context
Stumbled across this while looking at CLI output behavior. All the debug instrumentation is already written — rule source resolution, CGO mappings, matched rule sets, import additions — it's just unreachable.
I can open a PR shortly with the fix.