Skip to content

Commit

Permalink
refactor(prj): separate logger to core module
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Jun 12, 2024
1 parent b4d8c32 commit 26bad55
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (

"github.com/iyear/tdl/core/logctx"
"github.com/iyear/tdl/core/util/fsutil"
"github.com/iyear/tdl/core/util/logutil"
"github.com/iyear/tdl/pkg/consts"
"github.com/iyear/tdl/pkg/kv"
"github.com/iyear/tdl/pkg/logger"
"github.com/iyear/tdl/pkg/tclient"
)

Expand Down Expand Up @@ -48,7 +48,7 @@ func New() *cobra.Command {
level = zap.DebugLevel
}
cmd.SetContext(logctx.With(cmd.Context(),
logger.New(level, filepath.Join(consts.LogPath, "latest.log"))))
logutil.New(level, filepath.Join(consts.LogPath, "latest.log"))))

ns := viper.GetString(consts.FlagNamespace)
if ns != "" {
Expand Down
1 change: 1 addition & 0 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/net v0.25.0
golang.org/x/sync v0.7.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
Expand Down
2 changes: 2 additions & 0 deletions core/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/logger/logger.go → core/util/logutil/logutil.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package logger
package logutil

import (
"go.uber.org/zap"
Expand Down

0 comments on commit 26bad55

Please sign in to comment.