Skip to content

fix(enterprise/cli): add CODER_PROVISIONER_DAEMON_LOG_* options #11279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
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
Next Next commit
address linter complaints
  • Loading branch information
johnstcn committed Dec 19, 2023
commit 8249612028fe4c74b939319efee63e3c0b0d6409
2 changes: 1 addition & 1 deletion cli/clilog/clilog.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func WithTrace() Option {
return func(b *Builder) {
b.Trace = true
}

}

func WithVerbose() Option {
return func(b *Builder) {
b.Verbose = true
Expand Down
6 changes: 6 additions & 0 deletions enterprise/cli/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"golang.org/x/xerrors"

"cdr.dev/slog"
"cdr.dev/slog/sloggers/sloghuman"
agpl "github.com/coder/coder/v2/cli"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/cli/clilog"
Expand Down Expand Up @@ -105,6 +106,11 @@ func (r *RootCmd) provisionerDaemonStart() *clibase.Cmd {
}

logger, closeLogger, err := clilog.New(logOpts...).Build(inv)
if err != nil {
// Fall back to a basic logger
logger = slog.Make(sloghuman.Sink(inv.Stderr))
logger.Error(ctx, "failed to initialize logger", slog.Error(err))
}
defer closeLogger()

if len(tags) != 0 {
Expand Down