mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
remove "v2ray.com/core" in log (#478)
* format errlog output * fix test
This commit is contained in:
parent
9475e8df3c
commit
9c1ad3ab93
@ -37,7 +37,9 @@ func (err *Error) pkgPath() string {
|
||||
if err.pathObj == nil {
|
||||
return ""
|
||||
}
|
||||
return reflect.TypeOf(err.pathObj).PkgPath()
|
||||
// remove v2ray.com/core/
|
||||
oldPath := reflect.TypeOf(err.pathObj).PkgPath()
|
||||
return strings.Join(strings.Split(oldPath, "/")[2:], "/")
|
||||
}
|
||||
|
||||
// Error implements error.Error().
|
||||
|
@ -46,11 +46,11 @@ func TestErrorMessage(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
err: New("a").Base(New("b")).WithPathObj(e{}),
|
||||
msg: "v2ray.com/core/common/errors_test: a > b",
|
||||
msg: "common/errors_test: a > b",
|
||||
},
|
||||
{
|
||||
err: New("a").Base(New("b").WithPathObj(e{})),
|
||||
msg: "a > v2ray.com/core/common/errors_test: b",
|
||||
msg: "a > common/errors_test: b",
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user