mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
refactor(logging): Improve client loading and registration logs
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Separator used to visually group related log lines.
|
||||
var credentialSeparator = strings.Repeat("-", 70)
|
||||
|
||||
// LogSavingCredentials emits a consistent log message when persisting auth material.
|
||||
@@ -21,5 +22,5 @@ func LogSavingCredentials(path string) {
|
||||
|
||||
// LogCredentialSeparator adds a visual separator to group auth/key processing logs.
|
||||
func LogCredentialSeparator() {
|
||||
log.Info(credentialSeparator)
|
||||
log.Debug(credentialSeparator)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
misc "github.com/router-for-me/CLIProxyAPI/v6/internal/misc"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -148,6 +149,8 @@ func (r *ModelRegistry) RegisterClient(clientID, clientProvider string, models [
|
||||
delete(r.clientProviders, clientID)
|
||||
}
|
||||
log.Debugf("Registered client %s from provider %s with %d models", clientID, clientProvider, len(models))
|
||||
// Separator at the end of the registration block (acts as boundary to next group)
|
||||
misc.LogCredentialSeparator()
|
||||
}
|
||||
|
||||
// UnregisterClient removes a client and decrements counts for its models
|
||||
@@ -207,6 +210,8 @@ func (r *ModelRegistry) unregisterClientInternal(clientID string) {
|
||||
delete(r.clientProviders, clientID)
|
||||
}
|
||||
log.Debugf("Unregistered client %s", clientID)
|
||||
// Separator line after completing client unregistration (after the summary line)
|
||||
misc.LogCredentialSeparator()
|
||||
}
|
||||
|
||||
// SetModelQuotaExceeded marks a model as quota exceeded for a specific client
|
||||
|
||||
@@ -561,8 +561,7 @@ func (w *Watcher) reloadClients() {
|
||||
|
||||
w.refreshAuthState()
|
||||
|
||||
log.Infof("full client reload complete - old: %d clients, new: %d clients (%d auth files + %d GL API keys + %d Claude API keys + %d Codex keys + %d OpenAI-compat)",
|
||||
0,
|
||||
log.Infof("full client load complete - %d clients (%d auth files + %d GL API keys + %d Claude API keys + %d Codex keys + %d OpenAI-compat)",
|
||||
totalNewClients,
|
||||
authFileCount,
|
||||
glAPIKeyCount,
|
||||
|
||||
Reference in New Issue
Block a user