fix: make create session works

This commit is contained in:
Muyao CHEN
2024-10-13 21:55:26 +02:00
parent 7ff91bab1d
commit 9290bcf88c
9 changed files with 41 additions and 17 deletions

View File

@ -27,7 +27,7 @@ import (
"sync"
"git.vinchent.xyz/vinchent/howmuch/internal/pkg/core"
"git.vinchent.xyz/vinchent/howmuch/internal/pkg/middleware"
"git.vinchent.xyz/vinchent/howmuch/internal/pkg/shared"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
@ -110,8 +110,12 @@ func CtxLog(ctx core.Context) *zapLogger {
func (z *zapLogger) CtxLog(ctx core.Context) *zapLogger {
zz := z.clone()
if rid := ctx.GetHeader(middleware.XRequestID); rid != "" {
zz.z = zz.z.With(zap.Any(middleware.XRequestID, rid))
if rid := ctx.GetHeader(shared.XRequestID); rid != "" {
zz.z = zz.z.With(zap.Any(shared.XRequestID, rid))
}
if user := ctx.GetHeader(shared.XUserName); user != "" {
zz.z = zz.z.With(zap.Any(shared.XUserName, user))
}
return zz