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:
yuhan6665 2024-06-29 14:32:57 -04:00 committed by GitHub
parent 8320732743
commit 079d0bd8a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
291 changed files with 1837 additions and 2368 deletions

View file

@ -1,10 +1,12 @@
package conf
import (
"context"
"encoding/json"
"strings"
"github.com/xtls/xray-core/app/dns/fakedns"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/features/dns"
)
@ -28,7 +30,7 @@ func (f *FakeDNSConfig) UnmarshalJSON(data []byte) error {
case json.Unmarshal(data, &pools) == nil:
f.pools = pools
default:
return newError("invalid fakedns config")
return errors.New("invalid fakedns config")
}
return nil
}
@ -51,7 +53,7 @@ func (f *FakeDNSConfig) Build() (*fakedns.FakeDnsPoolMulti, error) {
return &fakeDNSPool, nil
}
return nil, newError("no valid FakeDNS config")
return nil, errors.New("no valid FakeDNS config")
}
type FakeDNSPostProcessingStage struct{}
@ -122,7 +124,7 @@ func (FakeDNSPostProcessingStage) Process(config *Config) error {
}
}
if !found {
newError("Defined FakeDNS but haven't enabled FakeDNS destOverride at any inbound.").AtWarning().WriteToLog()
errors.LogWarning(context.Background(), "Defined FakeDNS but haven't enabled FakeDNS destOverride at any inbound.")
}
}