mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
- Implemented a global logger with structured formatting for consistent log output. - Added support for rotating log files using Lumberjack. - Integrated new logging functionality with Gin HTTP server for unified log handling. - Replaced direct `log.Info` calls with `fmt.Printf` in non-critical paths to simplify core functionality.
26 lines
608 B
Go
26 lines
608 B
Go
package misc
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var credentialSeparator = strings.Repeat("-", 70)
|
|
|
|
// LogSavingCredentials emits a consistent log message when persisting auth material.
|
|
func LogSavingCredentials(path string) {
|
|
if path == "" {
|
|
return
|
|
}
|
|
// Use filepath.Clean so logs remain stable even if callers pass redundant separators.
|
|
fmt.Printf("Saving credentials to %s\n", filepath.Clean(path))
|
|
}
|
|
|
|
// LogCredentialSeparator adds a visual separator to group auth/key processing logs.
|
|
func LogCredentialSeparator() {
|
|
log.Info(credentialSeparator)
|
|
}
|