Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
handle all sdkproto.LogLevel enums
  • Loading branch information
johnstcn committed Mar 8, 2023
commit eba54ad1453144c0040dab11559debd44e630b5b
8 changes: 7 additions & 1 deletion provisionerd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,11 +1125,17 @@ func redactVariableValues(variableValues []*sdkproto.VariableValue) []*sdkproto.
// logProvisionerJobLog logs a message from the provisioner daemon at the appropriate level.
func (r *Runner) logProvisionerJobLog(ctx context.Context, logLevel sdkproto.LogLevel, msg string, fields ...slog.Field) {
switch logLevel {
case sdkproto.LogLevel_TRACE:
r.logger.Debug(ctx, msg, fields...) // There's no trace, so we'll just use debug.
case sdkproto.LogLevel_DEBUG:
r.logger.Debug(ctx, msg, fields...)
case sdkproto.LogLevel_INFO:
r.logger.Info(ctx, msg, fields...)
case sdkproto.LogLevel_WARN:
r.logger.Warn(ctx, msg, fields...)
case sdkproto.LogLevel_ERROR:
r.logger.Error(ctx, msg, fields...)
default:
default: // should never happen, but we should not explode either.
r.logger.Info(ctx, msg, fields...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, it could be possible that a customer misconfigures the Coder deployment, INFO will be selected as default logging level, and it can blow up the cluster if there are thousands of logs, but that's just theory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INFO is the status quo, and the only way for someone to select a different level is to set CODER_VERBOSE or --verbose, both of which need to be set explicitly.

}
}