Simplify lifecycle logs

This commit is contained in:
世界
2026-04-19 23:25:00 +08:00
parent 9ba5a05020
commit d395680ca2
6 changed files with 26 additions and 23 deletions

View File

@@ -12,7 +12,6 @@ import (
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"
F "github.com/sagernet/sing/common/format"
)
var _ adapter.InboundManager = (*Manager)(nil)
@@ -54,7 +53,7 @@ func (m *Manager) Start(stage adapter.StartStage) error {
if err != nil {
return E.Cause(err, stage, " ", name)
}
m.logger.Trace(stage, " ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
adapter.LogElapsed(m.logger, startTime, stage, " ", name)
}
return nil
}
@@ -79,7 +78,7 @@ func (m *Manager) Close() error {
return E.Cause(err, "close ", name)
})
monitor.Finish()
m.logger.Trace("close ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
adapter.LogElapsed(m.logger, startTime, "close ", name)
}
return nil
}
@@ -139,7 +138,7 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log.
if err != nil {
return E.Cause(err, stage, " ", name)
}
m.logger.Trace(stage, " ", name, " completed (", F.Seconds(time.Since(startTime).Seconds()), "s)")
adapter.LogElapsed(m.logger, startTime, stage, " ", name)
}
}
if existsInbound, loaded := m.inboundByTag[tag]; loaded {