Write logs to oom report

This commit is contained in:
世界
2026-08-30 17:41:41 +08:00
parent 2d581b35f3
commit 98512fc8f6
5 changed files with 51 additions and 15 deletions
+4 -1
View File
@@ -14,6 +14,7 @@ import (
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/daemon"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/service/oomkiller"
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/service"
@@ -74,10 +75,12 @@ func NewCommandServer(handler CommandServerHandler, platformInterface PlatformIn
// GroupID: sGroupID,
// SystemProxyEnabled: false,
})
reporter := &oomReporter{startedService: server.StartedService}
service.MustRegister[oomkiller.OOMReporter](ctx, reporter)
server.managedService = daemon.NewManagedService(daemon.ManagedServiceOptions{
Handler: (*platformHandler)(server),
Debug: sDebug,
OOMReporter: sOOMReporter,
OOMReporter: reporter,
})
return server, nil
}