Skip to content

Commit 144b222

Browse files
Add debug logging to GenerateRandomAPIKey in auth/apikey.go
Log function entry, success, and failure for GenerateRandomAPIKey using the existing package-level debug logger (declared in auth/header.go). This provides visibility into API key generation at startup when DEBUG=auth:* is enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 68ce183 commit 144b222

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/auth/apikey.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ import (
1010
// Per spec §7.3, the gateway SHOULD generate a random API key on startup
1111
// if none is provided. Returns a 32-byte hex-encoded string (64 chars).
1212
func GenerateRandomAPIKey() (string, error) {
13+
log.Print("Generating random API key")
1314
key, err := strutil.RandomHex(32)
1415
if err != nil {
16+
log.Printf("Random API key generation failed: %v", err)
1517
return "", fmt.Errorf("failed to generate random API key: %w", err)
1618
}
19+
log.Print("Random API key generated successfully")
1720
return key, nil
1821
}

0 commit comments

Comments
 (0)