Skip to content

Commit ce2abc8

Browse files
Copilotlpcox
andauthored
Use dedicated auth:apikey logger in GenerateRandomAPIKey
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/568a79f5-6ac8-4127-89d4-a791265c20b9 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 144b222 commit ce2abc8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/auth/apikey.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ package auth
33
import (
44
"fmt"
55

6+
"github.com/github/gh-aw-mcpg/internal/logger"
67
"github.com/github/gh-aw-mcpg/internal/strutil"
78
)
89

10+
var logAPIKey = logger.New("auth:apikey")
11+
912
// GenerateRandomAPIKey generates a cryptographically random API key.
1013
// Per spec §7.3, the gateway SHOULD generate a random API key on startup
1114
// if none is provided. Returns a 32-byte hex-encoded string (64 chars).
1215
func GenerateRandomAPIKey() (string, error) {
13-
log.Print("Generating random API key")
16+
logAPIKey.Print("Generating random API key")
1417
key, err := strutil.RandomHex(32)
1518
if err != nil {
16-
log.Printf("Random API key generation failed: %v", err)
19+
logAPIKey.Printf("Random API key generation failed: %v", err)
1720
return "", fmt.Errorf("failed to generate random API key: %w", err)
1821
}
19-
log.Print("Random API key generated successfully")
22+
logAPIKey.Print("Random API key generated successfully")
2023
return key, nil
2124
}

0 commit comments

Comments
 (0)