This commit is contained in:
pyihe
2022-08-15 15:00:04 +08:00
parent 65dfb49f35
commit 36122134d1
2 changed files with 9 additions and 1 deletions

View File

@@ -7,6 +7,14 @@ import (
"github.com/pyihe/go-pkg/errors"
)
func Copy(src []byte) (b []byte) {
if len(src) > 0 {
b = make([]byte, len(src))
copy(b, src)
}
return
}
func Int64(b []byte) (v int64, err error) {
if len(b) == 0 {
return

View File

@@ -57,7 +57,7 @@ func newZapLogger(opts ...LogOption) (Logger, error) {
encoder := getJSONEncoder()
op := zap.Fields(zap.String("ip", nets.GetLocalIP()), zap.String("app", zlogger.name))
op := zap.Fields(zap.String("ip", nets.LocalIP()), zap.String("app", zlogger.name))
options = append(options, op)
allLevel := zap.LevelEnablerFunc(func(lv zapcore.Level) bool {