You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can specify a custom logger when opening a database:
cfg, _:=mysql.ParseDSN(dsName)
// set a custom loggertracer:=log.New(os.Stdout, "[mysql] ", log.Ldate|log.Ltime|log.Lshortfile)
cfg.Logger=tracerconnector, err:=mysql.NewConnector(cfg)
iferr!=nil {
returnerr
}
db:=sql.OpenDB(connector)
But the logger won't log SQL statements from Exec() and Query(), but only some internal problems. See mysqlConn.log() usage.
Is it possible to add an sql logging in the driver? This may be a flag in a config like cfg.LogStatements = true or a separate logger/tracer field cfg.Tracer like this implemented in the PGX driver tracelog:
I need to log the raw SQL statements.
We can specify a custom logger when opening a database:
But the logger won't log SQL statements from
Exec()
andQuery()
, but only some internal problems. See mysqlConn.log() usage.Is it possible to add an sql logging in the driver? This may be a flag in a config like
cfg.LogStatements = true
or a separate logger/tracer fieldcfg.Tracer
like this implemented in the PGX driver tracelog:The text was updated successfully, but these errors were encountered: