mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Refactor log (#3446)
* Refactor log * Add new log methods * Fix logger test * Change all logging code * Clean up pathObj * Rebase to latest main * Remove invoking method name after the dot
This commit is contained in:
parent
8320732743
commit
079d0bd8a9
291 changed files with 1837 additions and 2368 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/xtls/xray-core/app/observatory"
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/dice"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/features/extension"
|
||||
)
|
||||
|
@ -95,7 +96,7 @@ func (s *LeastLoadStrategy) pickOutbounds(candidates []string) []*node {
|
|||
// with 'balancer.fallbackTag', it means: selects qualified nodes or use the fallback.
|
||||
func (s *LeastLoadStrategy) selectLeastLoad(nodes []*node) []*node {
|
||||
if len(nodes) == 0 {
|
||||
newError("least load: no qualified outbound").AtInfo().WriteToLog()
|
||||
errors.LogInfo(s.ctx, "least load: no qualified outbound")
|
||||
return nil
|
||||
}
|
||||
expected := int(s.settings.Expected)
|
||||
|
@ -123,7 +124,7 @@ func (s *LeastLoadStrategy) selectLeastLoad(nodes []*node) []*node {
|
|||
}
|
||||
// don't continue if find expected selects
|
||||
if count >= expected {
|
||||
newError("applied baseline: ", baseline).AtDebug().WriteToLog()
|
||||
errors.LogDebug(s.ctx, "applied baseline: ", baseline)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +143,7 @@ func (s *LeastLoadStrategy) getNodes(candidates []string, maxRTT time.Duration)
|
|||
}
|
||||
observeResult, err := s.observer.GetObservation(s.ctx)
|
||||
if err != nil {
|
||||
newError("cannot get observation").Base(err).WriteToLog()
|
||||
errors.LogInfoInner(s.ctx, err, "cannot get observation")
|
||||
return make([]*node, 0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue