Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/cli/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ func execCmd(cmd *cobra.Command, args []string) error {
gpus = "all"
}

// Use human-readable log format for local development
env := make([]string, len(envFlags))
copy(env, envFlags)
env = append(env, "LOG_FORMAT=console")

// Automatically propagate RUST_LOG for Rust coglet debugging
env := envFlags
if rustLog := os.Getenv("RUST_LOG"); rustLog != "" {
env = append(env, "RUST_LOG="+rustLog)
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/cli/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ func cmdServe(cmd *cobra.Command, arg []string) error {
args = append(args, "--upload-url", uploadURL)
}

// Use human-readable log format for local development
env := make([]string, len(envFlags))
copy(env, envFlags)
env = append(env, "LOG_FORMAT=console")

// Automatically propagate RUST_LOG for Rust coglet debugging
env := envFlags
if rustLog := os.Getenv("RUST_LOG"); rustLog != "" {
env = append(env, "RUST_LOG="+rustLog)
}
Expand Down
11 changes: 9 additions & 2 deletions pkg/predict/predictor.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,19 @@ type Predictor struct {
// NewPredictor constructs a Predictor. See PredictorOptions for the
// meaning of each field.
func NewPredictor(_ context.Context, opts PredictorOptions) (*Predictor, error) {
// Use human-readable log format for local development
env := make([]string, len(opts.RunOptions.Env))
copy(env, opts.RunOptions.Env)
env = append(env, "LOG_FORMAT=console")

if global.Debug {
opts.RunOptions.Env = append(opts.RunOptions.Env, "COG_LOG_LEVEL=debug")
env = append(env, "COG_LOG_LEVEL=debug")
} else {
opts.RunOptions.Env = append(opts.RunOptions.Env, "COG_LOG_LEVEL=warning")
env = append(env, "COG_LOG_LEVEL=warning")
}

opts.RunOptions.Env = env

return &Predictor{
runOptions: opts.RunOptions,
isTrain: opts.IsTrain,
Expand Down
Loading