Skip to content

Commit a59cb58

Browse files
committed
fix
1 parent a7f3a25 commit a59cb58

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

internal/pgengine/log_hook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func (hook *LogHook) send(cache []logrus.Entry) {
141141
[]string{"ts", "client_name", "pid", "log_level", "message", "message_data"},
142142
pgx.CopyFromSlice(len(cache),
143143
func(i int) ([]any, error) {
144+
if errVal, ok := cache[i].Data[logrus.ErrorKey]; ok {
145+
if e, isErr := errVal.(error); isErr && e != nil {
146+
cache[i].Data[logrus.ErrorKey] = e.Error()
147+
}
148+
}
149+
144150
jsonData, err := json.Marshal(cache[i].Data)
145151
if err != nil {
146152
return nil, err

internal/pgengine/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (pge *PgEngine) ExecuteSQLCommand(ctx context.Context, executor executor, t
124124
}
125125
if len(paramValues) == 0 { //mimic empty param
126126
ct, e := executor.Exec(ctx, task.Command)
127-
pge.LogTaskExecution(context.Background(), task, errCodes[err != nil], ct.String(), "")
127+
pge.LogTaskExecution(context.Background(), task, errCodes[e != nil], ct.String(), "")
128128
return e
129129
}
130130
for _, val := range paramValues {

0 commit comments

Comments
 (0)