feat: use human-readable log format for local CLI commands#2806
feat: use human-readable log format for local CLI commands#2806
Conversation
|
I'm Bonk, and I've done a quick review of your PR. Summary: This PR adds Issue Found: In // pkg/predict/predictor.go:62-63
runOptions.Env = append(runOptions.Env, "LOG_FORMAT=console")Unlike Recommendation: Follow the same pattern as env := make([]string, len(runOptions.Env))
copy(env, runOptions.Env)
runOptions.Env = append(env, "LOG_FORMAT=console")This is a medium severity issue because it could cause unexpected behavior if the caller relies on the original environment slice not being modified. The rest of the changes look good and are consistent with the stated goal. |
Coglet defaults to JSON structured logs for production (GKE/Stackdriver compatibility), but this makes local development output hard to read. Set LOG_FORMAT=console in cog serve, cog run, cog predict, and cog train so developers see human-readable logs locally. Production is unaffected since the env var is only set by the CLI for local commands.
17ca26a to
96c3dbc
Compare
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
Summary: This PR adds LOG_FORMAT=console environment variable to local CLI commands to display human-readable logs during development instead of JSON.
Issue Found:
In pkg/predict/predictor.go, there's a mutation bug. The code directly appends to runOptions.Env without making a copy first. If the caller reuses that slice elsewhere, they'll unexpectedly get the LOG_FORMAT=console variable.
|
Done! Posted a review comment about the slice mutation issue in |
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
|
LGTM The slice mutation bug has been fixed. I notice there's a duplicated comment on lines 63-64 of |
Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
|
LGTM |
Coglet defaults to JSON structured logs for production (GKE/Stackdriver compatibility), but this makes local development output hard to read.
Set LOG_FORMAT=console in cog serve, cog run, cog predict, and cog train so developers see human-readable logs locally. Production is unaffected since the env var is only set by the CLI for local commands.
Before:
After: