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

Commit4eafe01

Browse files
authored
feat: show build log timestamps in local time (#241)
The server-sent ISO8601 timestamps are not necessarily in the user'spreferred timezone. This change uses time.Local() to get the time inthe user's local time according to their system settings.
1 parent32fbd7e commit4eafe01

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

‎internal/cmd/rebuild.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,47 +91,66 @@ func trailBuildLogs(ctx context.Context, client *coder.Client, envID string) err
9191
iferr!=nil {
9292
returnerr
9393
}
94+
9495
vars*spinner.Spinner
9596
forl:=rangelogs {
9697
ifl.Err!=nil {
9798
returnl.Err
9899
}
100+
101+
logTime:=l.BuildLog.Time.Local()
102+
msg:=fmt.Sprintf("%s %s",logTime.Format(time.RFC3339),l.BuildLog.Msg)
103+
99104
switchl.BuildLog.Type {
100105
casecoder.BuildLogTypeStart:
101106
// the FE uses this to reset the UI
102107
// the CLI doesn't need to do anything here given that we only append to the trail
108+
103109
casecoder.BuildLogTypeStage:
104-
msg:=fmt.Sprintf("%s %s",l.BuildLog.Time.Format(time.RFC3339),l.BuildLog.Msg)
105110
if!isTerminal {
106111
fmt.Println(msg)
107112
continue
108113
}
114+
109115
ifs!=nil {
110116
s.Stop()
111117
fmt.Print("\n")
112118
}
119+
113120
s=newSpinner()
114121
s.Suffix=fmt.Sprintf(" -- %s",msg)
115122
s.FinalMSG=fmt.Sprintf("%s -- %s",check,msg)
116123
s.Start()
124+
117125
casecoder.BuildLogTypeSubstage:
118126
// TODO(@cmoog) add verbose substage printing
127+
if!verbose {
128+
continue
129+
}
130+
119131
casecoder.BuildLogTypeError:
120-
errMsg:=color.RedString("\t%s",l.BuildLog.Msg)
121132
if!isTerminal {
122-
fmt.Println(errMsg)
133+
fmt.Println(msg)
123134
continue
124135
}
136+
125137
ifs!=nil {
126138
s.FinalMSG=fmt.Sprintf("%s %s",failure,strings.TrimPrefix(s.Suffix," "))
127139
s.Stop()
140+
fmt.Print("\n")
128141
}
129-
fmt.Print(errMsg)
142+
130143
s=newSpinner()
144+
s.Suffix=color.RedString(" -- %s",msg)
145+
s.FinalMSG=color.RedString("%s -- %s",failure,msg)
146+
s.Start()
147+
131148
casecoder.BuildLogTypeDone:
132149
ifs!=nil {
133150
s.Stop()
151+
fmt.Print("\n")
134152
}
153+
135154
returnnil
136155
default:
137156
returnxerrors.Errorf("unknown buildlog type: %s",l.BuildLog.Type)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp