fix session context overwrite when logSessionId not set
This commit is contained in:
parent
3180c418c2
commit
28600a89ea
|
@ -757,7 +757,7 @@ func (session *Session) incrVersionFieldValue(fieldValue *reflect.Value) {
|
||||||
|
|
||||||
// Context sets the context on this session
|
// Context sets the context on this session
|
||||||
func (session *Session) Context(ctx context.Context) *Session {
|
func (session *Session) Context(ctx context.Context) *Session {
|
||||||
if session.ctx != nil {
|
if session.engine.logSessionID && session.ctx != nil {
|
||||||
ctx = context.WithValue(ctx, log.SessionIDKey, session.ctx.Value(log.SessionIDKey))
|
ctx = context.WithValue(ctx, log.SessionIDKey, session.ctx.Value(log.SessionIDKey))
|
||||||
ctx = context.WithValue(ctx, log.SessionKey, session.ctx.Value(log.SessionKey))
|
ctx = context.WithValue(ctx, log.SessionKey, session.ctx.Value(log.SessionKey))
|
||||||
ctx = context.WithValue(ctx, log.SessionShowSQLKey, session.ctx.Value(log.SessionShowSQLKey))
|
ctx = context.WithValue(ctx, log.SessionShowSQLKey, session.ctx.Value(log.SessionShowSQLKey))
|
||||||
|
|
Loading…
Reference in New Issue