Hi there!
I'm working with logging at the moment, and noticing that in the v4 Logger interface, I see SQL text in the data map under the "sql" key. For batched queries, unfortunately, it seems that this field is always the literal value "batch query".
Is there a way, in pgx, to log the individual statements that make up a batch?
My log configuration code, in essence:
func (la *LogAdapter) Log(ctx context.Context, level pgx.LogLevel, msg string, data map[string]interface{}) {
if sql, ok := data["sql"]; ok {
la.logger.Infof("Executing SQL: %s", sql)
}
}
config, err := pgxpool.ParseConfig(...)
// error handling omitted
config.ConnConfig.Logger = &LogAdapter{...}
Hi there!
I'm working with logging at the moment, and noticing that in the v4
Loggerinterface, I see SQL text in thedatamap under the "sql" key. For batched queries, unfortunately, it seems that this field is always the literal value"batch query".Is there a way, in pgx, to log the individual statements that make up a batch?
My log configuration code, in essence: