mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +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
|
@ -1,9 +0,0 @@
|
|||
package encoding
|
||||
|
||||
import "github.com/xtls/xray-core/common/errors"
|
||||
|
||||
type errPathObjHolder struct{}
|
||||
|
||||
func newError(values ...interface{}) *errors.Error {
|
||||
return errors.New(values...).WithPathObj(errPathObjHolder{})
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net"
|
||||
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
xnet "github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/net/cnc"
|
||||
"github.com/xtls/xray-core/common/signal/done"
|
||||
|
@ -79,7 +80,7 @@ func (h *HunkReaderWriter) forceFetch() error {
|
|||
return err
|
||||
}
|
||||
|
||||
return newError("failed to fetch hunk from gRPC tunnel").Base(err)
|
||||
return errors.New("failed to fetch hunk from gRPC tunnel").Base(err)
|
||||
}
|
||||
|
||||
h.buf = hunk.Data
|
||||
|
@ -135,7 +136,7 @@ func (h *HunkReaderWriter) Write(buf []byte) (int, error) {
|
|||
|
||||
err := h.hc.Send(&Hunk{Data: buf[:]})
|
||||
if err != nil {
|
||||
return 0, newError("failed to send data over gRPC tunnel").Base(err)
|
||||
return 0, errors.New("failed to send data over gRPC tunnel").Base(err)
|
||||
}
|
||||
return len(buf), nil
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net"
|
||||
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
xnet "github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/net/cnc"
|
||||
"github.com/xtls/xray-core/common/signal/done"
|
||||
|
@ -74,7 +75,7 @@ func (h *MultiHunkReaderWriter) forceFetch() error {
|
|||
return err
|
||||
}
|
||||
|
||||
return newError("failed to fetch hunk from gRPC tunnel").Base(err)
|
||||
return errors.New("failed to fetch hunk from gRPC tunnel").Base(err)
|
||||
}
|
||||
|
||||
h.buf = hunk.Data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue