fix logs not printing correctly, removed unneccessary loggers

This commit is contained in:
yusing
2025-01-20 17:42:54 +08:00
parent 64e85c3076
commit dd0bbdc7b4
38 changed files with 130 additions and 150 deletions

View File

@@ -30,7 +30,6 @@ const (
var (
cfCIDRsLastUpdate time.Time
cfCIDRsMu sync.Mutex
cfCIDRsLogger = logger.With().Str("name", "CloudflareRealIP").Logger()
)
var CloudflareRealIP = NewMiddleware[cloudflareRealIP]()
@@ -87,7 +86,7 @@ func tryFetchCFCIDR() (cfCIDRs []*types.CIDR) {
)
if err != nil {
cfCIDRsLastUpdate = time.Now().Add(-cfCIDRsUpdateRetryInterval - cfCIDRsUpdateInterval)
cfCIDRsLogger.Err(err).Msg("failed to update cloudflare range, retry in " + strutils.FormatDuration(cfCIDRsUpdateRetryInterval))
logging.Err(err).Msg("failed to update cloudflare range, retry in " + strutils.FormatDuration(cfCIDRsUpdateRetryInterval))
return nil
}
if len(cfCIDRs) == 0 {
@@ -96,7 +95,7 @@ func tryFetchCFCIDR() (cfCIDRs []*types.CIDR) {
}
cfCIDRsLastUpdate = time.Now()
cfCIDRsLogger.Info().Msg("cloudflare CIDR range updated")
logging.Info().Msg("cloudflare CIDR range updated")
return
}