Skip to content

Commit 5c7de02

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

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

cli/server_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,22 @@ 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+
countByWidth++
287+
} else {
288+
countByWidth += (len(line) + terminalWidth - 1) / terminalWidth
289+
}
286290
}
287-
return count
291+
return countByWidth
288292
}
289293

290294
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)