Skip to content

Commit b1b217b

Browse files
committed
change rotate key logs to debug
1 parent 4b8a30e commit b1b217b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

cli/server_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,23 @@ func TestServer(t *testing.T) {
273273
}
274274

275275
countLines := func(fullOutput string, terminalWidth int) int {
276-
lines := strings.Split(fullOutput, "\n")
277-
count := 0
276+
linesByNewline := strings.Split(fullOutput, "\n")
277+
countByWidth := 0
278278
lineLoop:
279-
for _, line := range lines {
279+
for _, line := range linesByNewline {
280280
for _, ignoreLine := range ignoreLines {
281281
if strings.Contains(line, ignoreLine) {
282282
continue lineLoop
283283
}
284284
}
285-
count += (len(line) + terminalWidth - 1) / terminalWidth
285+
if line == "" {
286+
// Empty lines take up one line.
287+
countByWidth++
288+
} else {
289+
countByWidth += (len(line) + terminalWidth - 1) / terminalWidth
290+
}
286291
}
287-
return count
292+
return countByWidth
288293
}
289294

290295
terminalWidth := 80

coderd/cryptokeys/rotate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (k *rotator) rotateKeys(ctx context.Context) error {
152152
}
153153
}
154154
if validKeys == 0 {
155-
k.logger.Info(ctx, "no valid keys detected, inserting new key",
155+
k.logger.Debug(ctx, "no valid keys detected, inserting new key",
156156
slog.F("feature", feature),
157157
)
158158
_, err := k.insertNewKey(ctx, tx, feature, now)
@@ -194,7 +194,7 @@ func (k *rotator) insertNewKey(ctx context.Context, tx database.Store, feature d
194194
return database.CryptoKey{}, xerrors.Errorf("inserting new key: %w", err)
195195
}
196196

197-
k.logger.Info(ctx, "inserted new key for feature", slog.F("feature", feature))
197+
k.logger.Debug(ctx, "inserted new key for feature", slog.F("feature", feature))
198198
return newKey, nil
199199
}
200200

0 commit comments

Comments
 (0)