fix: get ctx logger on new request (#198)

* fix: get ctx logger on new request

* chore: change log format

* fix: get ctx logger on new request
This commit is contained in:
xvzc 2024-08-29 07:50:08 +09:00 committed by GitHub
parent cc97550f80
commit 2aea4a7a51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -65,6 +65,7 @@ func (pxy *Proxy) Start(ctx context.Context) {
go func() { go func() {
ctx := util.GetCtxWithTraceId(ctx) ctx := util.GetCtxWithTraceId(ctx)
logger := log.GetCtxLogger(ctx)
pkt, err := packet.ReadHttpRequest(conn) pkt, err := packet.ReadHttpRequest(conn)
if err != nil { if err != nil {

View File

@ -23,8 +23,8 @@ func GetCtxLogger(ctx context.Context) zerolog.Logger {
func InitLogger(cfg *util.Config) { func InitLogger(cfg *util.Config) {
partsOrder := []string{ partsOrder := []string{
zerolog.TimestampFieldName,
zerolog.LevelFieldName, zerolog.LevelFieldName,
zerolog.TimestampFieldName,
traceIdFieldName, traceIdFieldName,
scopeFieldName, scopeFieldName,
zerolog.MessageFieldName, zerolog.MessageFieldName,