mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-20 18:42:36 +03:00
add logs
This commit is contained in:
parent
66e06dc2a9
commit
160a88611b
1 changed files with 4 additions and 2 deletions
|
@ -69,9 +69,11 @@ func Main() {
|
||||||
os.Exit(caddy.ExitCodeFailedStartup)
|
os.Exit(caddy.ExitCodeFailedStartup)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger := caddy.Log()
|
||||||
|
|
||||||
// Configure the maximum number of CPUs to use to match the Linux container quota (if any)
|
// Configure the maximum number of CPUs to use to match the Linux container quota (if any)
|
||||||
// See https://pkg.go.dev/runtime#GOMAXPROCS
|
// See https://pkg.go.dev/runtime#GOMAXPROCS
|
||||||
undo, err := maxprocs.Set()
|
undo, err := maxprocs.Set(maxprocs.Logger(logger.Sugar().Infof))
|
||||||
defer undo()
|
defer undo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
caddy.Log().Warn("failed to set GOMAXPROCS", zap.Error(err))
|
caddy.Log().Warn("failed to set GOMAXPROCS", zap.Error(err))
|
||||||
|
@ -81,7 +83,7 @@ func Main() {
|
||||||
// See https://pkg.go.dev/runtime/debug#SetMemoryLimit
|
// See https://pkg.go.dev/runtime/debug#SetMemoryLimit
|
||||||
_, _ = memlimit.SetGoMemLimitWithOpts(
|
_, _ = memlimit.SetGoMemLimitWithOpts(
|
||||||
memlimit.WithLogger(
|
memlimit.WithLogger(
|
||||||
slog.New(zapslog.NewHandler(caddy.Log().Core())),
|
slog.New(zapslog.NewHandler(logger.Core())),
|
||||||
),
|
),
|
||||||
memlimit.WithProvider(
|
memlimit.WithProvider(
|
||||||
memlimit.ApplyFallback(
|
memlimit.ApplyFallback(
|
||||||
|
|
Loading…
Reference in a new issue