Skip to content

Commit

Permalink
fix: get ctx logger on new request (#198)
Browse files Browse the repository at this point in the history
* fix: get ctx logger on new request

* chore: change log format

* fix: get ctx logger on new request
  • Loading branch information
xvzc authored Aug 28, 2024
1 parent cc97550 commit 2aea4a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (pxy *Proxy) Start(ctx context.Context) {

go func() {
ctx := util.GetCtxWithTraceId(ctx)
logger := log.GetCtxLogger(ctx)

pkt, err := packet.ReadHttpRequest(conn)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion util/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func GetCtxLogger(ctx context.Context) zerolog.Logger {

func InitLogger(cfg *util.Config) {
partsOrder := []string{
zerolog.TimestampFieldName,
zerolog.LevelFieldName,
zerolog.TimestampFieldName,
traceIdFieldName,
scopeFieldName,
zerolog.MessageFieldName,
Expand Down

0 comments on commit 2aea4a7

Please sign in to comment.