Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

feat: show build log timestamps in local time#241

Merged
jawnsy merged 1 commit intomasterfromjawnsy/ch8016/cli-local-timezone
Feb 12, 2021
Merged
Changes fromall 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
27 changes: 23 additions & 4 deletionsinternal/cmd/rebuild.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -91,47 +91,66 @@ func trailBuildLogs(ctx context.Context, client *coder.Client, envID string) err
if err != nil {
return err
}

var s *spinner.Spinner
for l := range logs {
if l.Err != nil {
return l.Err
}

logTime := l.BuildLog.Time.Local()
msg := fmt.Sprintf("%s %s", logTime.Format(time.RFC3339), l.BuildLog.Msg)

switch l.BuildLog.Type {
case coder.BuildLogTypeStart:
// the FE uses this to reset the UI
// the CLI doesn't need to do anything here given that we only append to the trail

case coder.BuildLogTypeStage:
msg := fmt.Sprintf("%s %s", l.BuildLog.Time.Format(time.RFC3339), l.BuildLog.Msg)
if !isTerminal {
fmt.Println(msg)
continue
}

if s != nil {
s.Stop()
fmt.Print("\n")
}

s = newSpinner()
s.Suffix = fmt.Sprintf(" -- %s", msg)
s.FinalMSG = fmt.Sprintf("%s -- %s", check, msg)
s.Start()

case coder.BuildLogTypeSubstage:
// TODO(@cmoog) add verbose substage printing
if !verbose {
continue
}

case coder.BuildLogTypeError:
errMsg := color.RedString("\t%s", l.BuildLog.Msg)
if !isTerminal {
fmt.Println(errMsg)
fmt.Println(msg)
continue
}

if s != nil {
s.FinalMSG = fmt.Sprintf("%s %s", failure, strings.TrimPrefix(s.Suffix, " "))
s.Stop()
fmt.Print("\n")
}
fmt.Print(errMsg)

s = newSpinner()
s.Suffix = color.RedString(" -- %s", msg)
s.FinalMSG = color.RedString("%s -- %s", failure, msg)
s.Start()

case coder.BuildLogTypeDone:
if s != nil {
s.Stop()
fmt.Print("\n")
}

return nil
default:
return xerrors.Errorf("unknown buildlog type: %s", l.BuildLog.Type)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp