diff --git a/conn.go b/conn.go index 43b9bd4..1e16153 100644 --- a/conn.go +++ b/conn.go @@ -4,7 +4,6 @@ import ( "context" "database/sql/driver" "errors" - "fmt" "log/slog" ) @@ -47,7 +46,7 @@ func defaultConnOptions(driverName string, msgb StepEventMsgBuilder) *connOption Close: *defaultStepOptions(msgb, StepConnClose, LevelInfo), Prepare: *defaultStepOptions(msgb, StepConnPrepare, LevelInfo), - PrepareContext: *defaultStepOptions(msgb, StepConnPrepareContext, LevelInfo), + PrepareContext: *defaultStepOptions(msgb, StepConnPrepareContext, LevelTrace), StmtIDKey: StmtIDKeyDefault, StmtOptions: stmtOptions, @@ -235,7 +234,7 @@ func (c *connWithContextWrapper) ExecContext(ctx context.Context, query string, var result driver.Result lg := c.logger.With( slog.String("query", query), - slog.String("args", fmt.Sprintf("%+v", args)), + slog.String("args", formatNamedValues(args)), ) err := ignoreAttr(lg.Step(ctx, &c.options.ExecContext, func() (*slog.Attr, error) { var err error @@ -253,7 +252,7 @@ func (c *connWithContextWrapper) QueryContext(ctx context.Context, query string, var rows driver.Rows lg := c.logger.With( slog.String("query", query), - slog.String("args", fmt.Sprintf("%+v", args)), + slog.String("args", formatNamedValues(args)), ) err := ignoreAttr(lg.Step(ctx, &c.options.QueryContext, func() (*slog.Attr, error) { var err error diff --git a/examples/logs-mysql/results/debug-log.txt b/examples/logs-mysql/results/debug-log.txt index e7dba09..556d38a 100644 --- a/examples/logs-mysql/results/debug-log.txt +++ b/examples/logs-mysql/results/debug-log.txt @@ -1,65 +1,34 @@ -time=2025-02-19T08:24:59.722+09:00 level=DEBUG msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:24:59.722+09:00 level=DEBUG msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:24:59.722+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=3208 conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:24:59.722+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=225000 -time=2025-02-19T08:24:59.722+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:59.722+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:24:59.725+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=2847375 error="driver: bad connection" -time=2025-02-19T08:24:59.725+09:00 level=ERROR msg=Connector.Connect duration=2927833 error="driver: bad connection" -time=2025-02-19T08:24:59.725+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:59.725+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:24:59.726+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=977416 error="driver: bad connection" -time=2025-02-19T08:24:59.726+09:00 level=ERROR msg=Connector.Connect duration=1028333 error="driver: bad connection" -time=2025-02-19T08:24:59.726+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:59.726+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:24:59.730+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=3485500 error="driver: bad connection" -time=2025-02-19T08:24:59.730+09:00 level=ERROR msg=Connector.Connect duration=3563666 error="driver: bad connection" -time=2025-02-19T08:25:01.731+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:01.731+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:01.735+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=3532208 error="driver: bad connection" -time=2025-02-19T08:25:01.735+09:00 level=ERROR msg=Connector.Connect duration=3716958 error="driver: bad connection" -time=2025-02-19T08:25:01.735+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:01.735+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:01.738+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=3166875 error="driver: bad connection" -time=2025-02-19T08:25:01.738+09:00 level=ERROR msg=Connector.Connect duration=3307167 error="driver: bad connection" -time=2025-02-19T08:25:01.738+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:01.738+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:01.742+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=3507917 error="driver: bad connection" -time=2025-02-19T08:25:01.742+09:00 level=ERROR msg=Connector.Connect duration=3641417 error="driver: bad connection" -time=2025-02-19T08:25:03.743+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:03.743+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:03.747+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=3340041 error="driver: bad connection" -time=2025-02-19T08:25:03.747+09:00 level=ERROR msg=Connector.Connect duration=3583292 error="driver: bad connection" -time=2025-02-19T08:25:03.747+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:03.747+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:03.750+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=2590291 error="driver: bad connection" -time=2025-02-19T08:25:03.750+09:00 level=ERROR msg=Connector.Connect duration=2747792 error="driver: bad connection" -time=2025-02-19T08:25:03.750+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:03.750+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:03.752+09:00 level=ERROR msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=1661208 error="driver: bad connection" -time=2025-02-19T08:25:03.752+09:00 level=ERROR msg=Connector.Connect duration=1868625 error="driver: bad connection" -time=2025-02-19T08:25:05.753+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:05.753+09:00 level=DEBUG msg=Connector.Connect conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:05.757+09:00 level=INFO msg=Connector.Connect conn_id=GcehcYURvlj4lPDG duration=4553417 -time=2025-02-19T08:25:05.757+09:00 level=INFO msg=Connector.Connect duration=4614041 -time=2025-02-19T08:25:05.758+09:00 level=DEBUG msg=Conn.ExecContext conn_id=GcehcYURvlj4lPDG query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:25:05.774+09:00 level=INFO msg=Conn.ExecContext conn_id=GcehcYURvlj4lPDG query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=15872083 -time=2025-02-19T08:25:05.774+09:00 level=DEBUG msg=Conn.BeginTx conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:05.774+09:00 level=INFO msg=Conn.BeginTx conn_id=GcehcYURvlj4lPDG duration=311917 tx_id=P_5GU9YZ66Q7cVCQ -time=2025-02-19T08:25:05.774+09:00 level=DEBUG msg=Conn.ExecContext conn_id=GcehcYURvlj4lPDG query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:05.775+09:00 level=INFO msg=Conn.ExecContext conn_id=GcehcYURvlj4lPDG query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=375 skip=true -time=2025-02-19T08:25:05.775+09:00 level=DEBUG msg=Conn.PrepareContext conn_id=GcehcYURvlj4lPDG query="INSERT INTO test1 (id, name) VALUES (?, ?)" -time=2025-02-19T08:25:05.776+09:00 level=INFO msg=Conn.PrepareContext conn_id=GcehcYURvlj4lPDG query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=1626541 stmt_id=nAPIE1kqEGIjsNpe -time=2025-02-19T08:25:05.776+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=GcehcYURvlj4lPDG stmt_id=nAPIE1kqEGIjsNpe args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:05.777+09:00 level=INFO msg=Stmt.ExecContext conn_id=GcehcYURvlj4lPDG stmt_id=nAPIE1kqEGIjsNpe args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=349958 -time=2025-02-19T08:25:05.777+09:00 level=DEBUG msg=Stmt.Close conn_id=GcehcYURvlj4lPDG stmt_id=nAPIE1kqEGIjsNpe -time=2025-02-19T08:25:05.777+09:00 level=INFO msg=Stmt.Close conn_id=GcehcYURvlj4lPDG stmt_id=nAPIE1kqEGIjsNpe duration=4625 -time=2025-02-19T08:25:05.777+09:00 level=DEBUG msg=Tx.Commit conn_id=GcehcYURvlj4lPDG tx_id=P_5GU9YZ66Q7cVCQ -time=2025-02-19T08:25:05.779+09:00 level=INFO msg=Tx.Commit conn_id=GcehcYURvlj4lPDG tx_id=P_5GU9YZ66Q7cVCQ duration=2369584 -time=2025-02-19T08:25:05.779+09:00 level=DEBUG msg=Conn.QueryContext conn_id=GcehcYURvlj4lPDG query="SELECT * FROM test1" args=[] duration=348542 -time=2025-02-19T08:25:05.779+09:00 level=DEBUG msg=Rows.Next conn_id=GcehcYURvlj4lPDG duration=13333 eof=false -time=2025-02-19T08:25:05.779+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:25:05.779+09:00 level=DEBUG msg=Rows.Next conn_id=GcehcYURvlj4lPDG duration=83 eof=true -time=2025-02-19T08:25:05.779+09:00 level=DEBUG msg=Rows.Close conn_id=GcehcYURvlj4lPDG duration=125 -time=2025-02-19T08:25:05.779+09:00 level=DEBUG msg=Conn.Close conn_id=GcehcYURvlj4lPDG -time=2025-02-19T08:25:05.779+09:00 level=INFO msg=Conn.Close conn_id=GcehcYURvlj4lPDG duration=18083 +time=2025-08-06T23:24:18.087+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=10917 conn_id=OeV2RQ9XRdMCt45H +time=2025-08-06T23:24:18.087+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=470875 +time=2025-08-06T23:24:18.089+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=2305125 error="driver: bad connection" +time=2025-08-06T23:24:18.089+09:00 level=ERROR msg=Connector.Connect duration=2338958 error="driver: bad connection" +time=2025-08-06T23:24:18.090+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=714542 error="driver: bad connection" +time=2025-08-06T23:24:18.090+09:00 level=ERROR msg=Connector.Connect duration=770750 error="driver: bad connection" +time=2025-08-06T23:24:18.091+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=683833 error="driver: bad connection" +time=2025-08-06T23:24:18.091+09:00 level=ERROR msg=Connector.Connect duration=693000 error="driver: bad connection" +time=2025-08-06T23:24:20.093+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=1196917 error="driver: bad connection" +time=2025-08-06T23:24:20.093+09:00 level=ERROR msg=Connector.Connect duration=1244834 error="driver: bad connection" +time=2025-08-06T23:24:20.094+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=1030584 error="driver: bad connection" +time=2025-08-06T23:24:20.094+09:00 level=ERROR msg=Connector.Connect duration=1042042 error="driver: bad connection" +time=2025-08-06T23:24:20.096+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=1188083 error="driver: bad connection" +time=2025-08-06T23:24:20.096+09:00 level=ERROR msg=Connector.Connect duration=1195750 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=843625 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect duration=874750 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=464875 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect duration=475041 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=337459 error="driver: bad connection" +time=2025-08-06T23:24:22.097+09:00 level=ERROR msg=Connector.Connect duration=346666 error="driver: bad connection" +time=2025-08-06T23:24:24.103+09:00 level=INFO msg=Connector.Connect conn_id=OeV2RQ9XRdMCt45H duration=4660583 +time=2025-08-06T23:24:24.103+09:00 level=INFO msg=Connector.Connect duration=4740458 +time=2025-08-06T23:24:24.122+09:00 level=INFO msg=Conn.ExecContext conn_id=OeV2RQ9XRdMCt45H query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=17941958 +time=2025-08-06T23:24:24.122+09:00 level=INFO msg=Conn.BeginTx conn_id=OeV2RQ9XRdMCt45H duration=244000 tx_id=2Z_gwjGK0ZsOhmKL +time=2025-08-06T23:24:24.122+09:00 level=INFO msg=Conn.ExecContext conn_id=OeV2RQ9XRdMCt45H query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" duration=541 skip=true +time=2025-08-06T23:24:24.127+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=OeV2RQ9XRdMCt45H stmt_id=Sh0A2dDAax1M8Fuj args="[1,\"Alice\"]" duration=610916 +time=2025-08-06T23:24:24.127+09:00 level=DEBUG msg=Stmt.Close conn_id=OeV2RQ9XRdMCt45H stmt_id=Sh0A2dDAax1M8Fuj duration=7917 +time=2025-08-06T23:24:24.128+09:00 level=INFO msg=Tx.Commit conn_id=OeV2RQ9XRdMCt45H tx_id=2Z_gwjGK0ZsOhmKL duration=1560625 +time=2025-08-06T23:24:24.129+09:00 level=DEBUG msg=Conn.QueryContext conn_id=OeV2RQ9XRdMCt45H query="SELECT * FROM test1" args=[] duration=299875 +time=2025-08-06T23:24:24.129+09:00 level=DEBUG msg=Rows.Next conn_id=OeV2RQ9XRdMCt45H duration=1458 eof=false +time=2025-08-06T23:24:24.129+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:24.129+09:00 level=DEBUG msg=Rows.Next conn_id=OeV2RQ9XRdMCt45H duration=42 eof=true +time=2025-08-06T23:24:24.129+09:00 level=DEBUG msg=Rows.Close conn_id=OeV2RQ9XRdMCt45H duration=167 +time=2025-08-06T23:24:24.129+09:00 level=INFO msg=Conn.Close conn_id=OeV2RQ9XRdMCt45H duration=20500 diff --git a/examples/logs-mysql/results/info-log.txt b/examples/logs-mysql/results/info-log.txt index bf094c4..5f04202 100644 --- a/examples/logs-mysql/results/info-log.txt +++ b/examples/logs-mysql/results/info-log.txt @@ -1,31 +1,34 @@ -time=2025-02-19T08:24:52.280+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=16208 conn_id=clbVGbfgqOhHOilv -time=2025-02-19T08:24:52.281+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=526584 -time=2025-02-19T08:24:52.284+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=2823792 error="driver: bad connection" -time=2025-02-19T08:24:52.284+09:00 level=ERROR msg=Connector.Connect duration=2877584 error="driver: bad connection" -time=2025-02-19T08:24:52.289+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=5037292 error="driver: bad connection" -time=2025-02-19T08:24:52.289+09:00 level=ERROR msg=Connector.Connect duration=5073709 error="driver: bad connection" -time=2025-02-19T08:24:52.290+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=1040458 error="driver: bad connection" -time=2025-02-19T08:24:52.290+09:00 level=ERROR msg=Connector.Connect duration=1102916 error="driver: bad connection" -time=2025-02-19T08:24:54.292+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=1334625 error="driver: bad connection" -time=2025-02-19T08:24:54.292+09:00 level=ERROR msg=Connector.Connect duration=1369917 error="driver: bad connection" -time=2025-02-19T08:24:54.293+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=725208 error="driver: bad connection" -time=2025-02-19T08:24:54.293+09:00 level=ERROR msg=Connector.Connect duration=746541 error="driver: bad connection" -time=2025-02-19T08:24:54.294+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=747291 error="driver: bad connection" -time=2025-02-19T08:24:54.294+09:00 level=ERROR msg=Connector.Connect duration=832750 error="driver: bad connection" -time=2025-02-19T08:24:56.298+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=2891250 error="driver: bad connection" -time=2025-02-19T08:24:56.298+09:00 level=ERROR msg=Connector.Connect duration=3038292 error="driver: bad connection" -time=2025-02-19T08:24:56.299+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=611542 error="driver: bad connection" -time=2025-02-19T08:24:56.299+09:00 level=ERROR msg=Connector.Connect duration=641333 error="driver: bad connection" -time=2025-02-19T08:24:56.300+09:00 level=ERROR msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=721334 error="driver: bad connection" -time=2025-02-19T08:24:56.300+09:00 level=ERROR msg=Connector.Connect duration=769250 error="driver: bad connection" -time=2025-02-19T08:24:58.307+09:00 level=INFO msg=Connector.Connect conn_id=clbVGbfgqOhHOilv duration=6212333 -time=2025-02-19T08:24:58.307+09:00 level=INFO msg=Connector.Connect duration=6373000 -time=2025-02-19T08:24:58.328+09:00 level=INFO msg=Conn.ExecContext conn_id=clbVGbfgqOhHOilv query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=20119875 -time=2025-02-19T08:24:58.329+09:00 level=INFO msg=Conn.BeginTx conn_id=clbVGbfgqOhHOilv duration=536667 tx_id=IiNjHHNd_eLrgYyb -time=2025-02-19T08:24:58.330+09:00 level=INFO msg=Conn.ExecContext conn_id=clbVGbfgqOhHOilv query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=1209 skip=true -time=2025-02-19T08:24:58.332+09:00 level=INFO msg=Conn.PrepareContext conn_id=clbVGbfgqOhHOilv query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=2173458 stmt_id=rcBX4pdS0w5Vhglc -time=2025-02-19T08:24:58.333+09:00 level=INFO msg=Stmt.ExecContext conn_id=clbVGbfgqOhHOilv stmt_id=rcBX4pdS0w5Vhglc args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=605208 -time=2025-02-19T08:24:58.333+09:00 level=INFO msg=Stmt.Close conn_id=clbVGbfgqOhHOilv stmt_id=rcBX4pdS0w5Vhglc duration=22709 -time=2025-02-19T08:24:58.335+09:00 level=INFO msg=Tx.Commit conn_id=clbVGbfgqOhHOilv tx_id=IiNjHHNd_eLrgYyb duration=1991750 -time=2025-02-19T08:24:58.335+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:58.336+09:00 level=INFO msg=Conn.Close conn_id=clbVGbfgqOhHOilv duration=50083 +time=2025-08-06T23:24:08.002+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=20000 conn_id=DfU15vIYYze23D37 +time=2025-08-06T23:24:08.002+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=1456250 +time=2025-08-06T23:24:08.005+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=3119500 error="driver: bad connection" +time=2025-08-06T23:24:08.005+09:00 level=ERROR msg=Connector.Connect duration=3177541 error="driver: bad connection" +time=2025-08-06T23:24:08.006+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=700125 error="driver: bad connection" +time=2025-08-06T23:24:08.006+09:00 level=ERROR msg=Connector.Connect duration=746833 error="driver: bad connection" +time=2025-08-06T23:24:08.006+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=515250 error="driver: bad connection" +time=2025-08-06T23:24:08.006+09:00 level=ERROR msg=Connector.Connect duration=556833 error="driver: bad connection" +time=2025-08-06T23:24:10.009+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=1850209 error="driver: bad connection" +time=2025-08-06T23:24:10.009+09:00 level=ERROR msg=Connector.Connect duration=1957167 error="driver: bad connection" +time=2025-08-06T23:24:10.010+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=1011375 error="driver: bad connection" +time=2025-08-06T23:24:10.010+09:00 level=ERROR msg=Connector.Connect duration=1046458 error="driver: bad connection" +time=2025-08-06T23:24:10.011+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=605875 error="driver: bad connection" +time=2025-08-06T23:24:10.011+09:00 level=ERROR msg=Connector.Connect duration=615958 error="driver: bad connection" +time=2025-08-06T23:24:12.013+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=1167709 error="driver: bad connection" +time=2025-08-06T23:24:12.013+09:00 level=ERROR msg=Connector.Connect duration=1237792 error="driver: bad connection" +time=2025-08-06T23:24:12.014+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=778959 error="driver: bad connection" +time=2025-08-06T23:24:12.014+09:00 level=ERROR msg=Connector.Connect duration=828834 error="driver: bad connection" +time=2025-08-06T23:24:12.014+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=622583 error="driver: bad connection" +time=2025-08-06T23:24:12.014+09:00 level=ERROR msg=Connector.Connect duration=686917 error="driver: bad connection" +time=2025-08-06T23:24:14.020+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=4834000 error="driver: bad connection" +time=2025-08-06T23:24:14.021+09:00 level=ERROR msg=Connector.Connect duration=5222417 error="driver: bad connection" +time=2025-08-06T23:24:14.023+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=1818292 error="driver: bad connection" +time=2025-08-06T23:24:14.023+09:00 level=ERROR msg=Connector.Connect duration=1909917 error="driver: bad connection" +time=2025-08-06T23:24:14.024+09:00 level=ERROR msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=1358083 error="driver: bad connection" +time=2025-08-06T23:24:14.024+09:00 level=ERROR msg=Connector.Connect duration=1482167 error="driver: bad connection" +time=2025-08-06T23:24:16.028+09:00 level=INFO msg=Connector.Connect conn_id=DfU15vIYYze23D37 duration=2883875 +time=2025-08-06T23:24:16.028+09:00 level=INFO msg=Connector.Connect duration=2958417 +time=2025-08-06T23:24:16.043+09:00 level=INFO msg=Conn.ExecContext conn_id=DfU15vIYYze23D37 query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=14629041 +time=2025-08-06T23:24:16.043+09:00 level=INFO msg=Conn.BeginTx conn_id=DfU15vIYYze23D37 duration=367084 tx_id=NxCr1kqGEs0dOBQz +time=2025-08-06T23:24:16.043+09:00 level=INFO msg=Conn.ExecContext conn_id=DfU15vIYYze23D37 query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" duration=500 skip=true +time=2025-08-06T23:24:16.049+09:00 level=INFO msg=Tx.Commit conn_id=DfU15vIYYze23D37 tx_id=NxCr1kqGEs0dOBQz duration=1386458 +time=2025-08-06T23:24:16.049+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:16.049+09:00 level=INFO msg=Conn.Close conn_id=DfU15vIYYze23D37 duration=27667 diff --git a/examples/logs-mysql/results/trace-log.txt b/examples/logs-mysql/results/trace-log.txt index 99f7d2d..cc6af01 100644 --- a/examples/logs-mysql/results/trace-log.txt +++ b/examples/logs-mysql/results/trace-log.txt @@ -1,75 +1,69 @@ -time=2025-02-19T08:25:07.327+09:00 level=DEBUG msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:25:07.328+09:00 level=DEBUG msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:25:07.328+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=2916 conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:07.328+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=212583 -time=2025-02-19T08:25:07.328+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:07.328+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:07.330+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=2366958 error="driver: bad connection" -time=2025-02-19T08:25:07.330+09:00 level=ERROR msg=Connector.Connect duration=2444959 error="driver: bad connection" -time=2025-02-19T08:25:07.330+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:07.330+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:07.331+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=616750 error="driver: bad connection" -time=2025-02-19T08:25:07.331+09:00 level=ERROR msg=Connector.Connect duration=649417 error="driver: bad connection" -time=2025-02-19T08:25:07.331+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:07.331+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:07.331+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=459750 error="driver: bad connection" -time=2025-02-19T08:25:07.331+09:00 level=ERROR msg=Connector.Connect duration=490750 error="driver: bad connection" -time=2025-02-19T08:25:09.333+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:09.333+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:09.337+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=3817458 error="driver: bad connection" -time=2025-02-19T08:25:09.337+09:00 level=ERROR msg=Connector.Connect duration=4031292 error="driver: bad connection" -time=2025-02-19T08:25:09.337+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:09.337+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:09.339+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=2189000 error="driver: bad connection" -time=2025-02-19T08:25:09.339+09:00 level=ERROR msg=Connector.Connect duration=2362875 error="driver: bad connection" -time=2025-02-19T08:25:09.339+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:09.339+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:09.341+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=1834750 error="driver: bad connection" -time=2025-02-19T08:25:09.341+09:00 level=ERROR msg=Connector.Connect duration=2001917 error="driver: bad connection" -time=2025-02-19T08:25:11.343+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:11.343+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:11.345+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=2030375 error="driver: bad connection" -time=2025-02-19T08:25:11.345+09:00 level=ERROR msg=Connector.Connect duration=2132709 error="driver: bad connection" -time=2025-02-19T08:25:11.345+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:11.345+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:11.346+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=790917 error="driver: bad connection" -time=2025-02-19T08:25:11.346+09:00 level=ERROR msg=Connector.Connect duration=848959 error="driver: bad connection" -time=2025-02-19T08:25:11.346+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:11.346+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:11.346+09:00 level=ERROR msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=595542 error="driver: bad connection" -time=2025-02-19T08:25:11.346+09:00 level=ERROR msg=Connector.Connect duration=653125 error="driver: bad connection" -time=2025-02-19T08:25:13.347+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:13.347+09:00 level=DEBUG msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.353+09:00 level=INFO msg=Connector.Connect conn_id=DakzQLN_ilUa3qN8 duration=6077459 -time=2025-02-19T08:25:13.353+09:00 level=INFO msg=Connector.Connect duration=6225750 -time=2025-02-19T08:25:13.354+09:00 level=TRACE msg=Conn.Ping conn_id=DakzQLN_ilUa3qN8 duration=611459 -time=2025-02-19T08:25:13.354+09:00 level=TRACE msg=Conn.ResetSession conn_id=DakzQLN_ilUa3qN8 duration=9000 -time=2025-02-19T08:25:13.354+09:00 level=DEBUG msg=Conn.ExecContext conn_id=DakzQLN_ilUa3qN8 query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:25:13.371+09:00 level=INFO msg=Conn.ExecContext conn_id=DakzQLN_ilUa3qN8 query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=16803250 -time=2025-02-19T08:25:13.371+09:00 level=TRACE msg=Conn.ResetSession conn_id=DakzQLN_ilUa3qN8 duration=5583 -time=2025-02-19T08:25:13.371+09:00 level=TRACE msg=Conn.Ping conn_id=DakzQLN_ilUa3qN8 duration=531583 -time=2025-02-19T08:25:13.371+09:00 level=TRACE msg=Conn.ResetSession conn_id=DakzQLN_ilUa3qN8 duration=2667 -time=2025-02-19T08:25:13.371+09:00 level=DEBUG msg=Conn.BeginTx conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.372+09:00 level=INFO msg=Conn.BeginTx conn_id=DakzQLN_ilUa3qN8 duration=634875 tx_id=O85OXklLPYwG90t4 -time=2025-02-19T08:25:13.372+09:00 level=DEBUG msg=Conn.ExecContext conn_id=DakzQLN_ilUa3qN8 query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:13.372+09:00 level=INFO msg=Conn.ExecContext conn_id=DakzQLN_ilUa3qN8 query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=875 skip=true -time=2025-02-19T08:25:13.372+09:00 level=DEBUG msg=Conn.PrepareContext conn_id=DakzQLN_ilUa3qN8 query="INSERT INTO test1 (id, name) VALUES (?, ?)" -time=2025-02-19T08:25:13.374+09:00 level=INFO msg=Conn.PrepareContext conn_id=DakzQLN_ilUa3qN8 query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=2129541 stmt_id=uw0QbKVPFpGwALfk -time=2025-02-19T08:25:13.374+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=DakzQLN_ilUa3qN8 stmt_id=uw0QbKVPFpGwALfk args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:13.375+09:00 level=INFO msg=Stmt.ExecContext conn_id=DakzQLN_ilUa3qN8 stmt_id=uw0QbKVPFpGwALfk args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=567125 -time=2025-02-19T08:25:13.375+09:00 level=DEBUG msg=Stmt.Close conn_id=DakzQLN_ilUa3qN8 stmt_id=uw0QbKVPFpGwALfk -time=2025-02-19T08:25:13.375+09:00 level=INFO msg=Stmt.Close conn_id=DakzQLN_ilUa3qN8 stmt_id=uw0QbKVPFpGwALfk duration=22292 -time=2025-02-19T08:25:13.375+09:00 level=DEBUG msg=Tx.Commit conn_id=DakzQLN_ilUa3qN8 tx_id=O85OXklLPYwG90t4 -time=2025-02-19T08:25:13.377+09:00 level=INFO msg=Tx.Commit conn_id=DakzQLN_ilUa3qN8 tx_id=O85OXklLPYwG90t4 duration=1819792 -time=2025-02-19T08:25:13.377+09:00 level=TRACE msg=Conn.ResetSession conn_id=DakzQLN_ilUa3qN8 duration=4875 -time=2025-02-19T08:25:13.377+09:00 level=TRACE msg=Conn.QueryContext conn_id=DakzQLN_ilUa3qN8 query="SELECT * FROM test1" args=[] -time=2025-02-19T08:25:13.377+09:00 level=DEBUG msg=Conn.QueryContext conn_id=DakzQLN_ilUa3qN8 query="SELECT * FROM test1" args=[] duration=479541 -time=2025-02-19T08:25:13.377+09:00 level=TRACE msg=Rows.Next conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.377+09:00 level=DEBUG msg=Rows.Next conn_id=DakzQLN_ilUa3qN8 duration=42042 eof=false -time=2025-02-19T08:25:13.377+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:25:13.377+09:00 level=TRACE msg=Rows.Next conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.377+09:00 level=DEBUG msg=Rows.Next conn_id=DakzQLN_ilUa3qN8 duration=417 eof=true -time=2025-02-19T08:25:13.378+09:00 level=TRACE msg=Rows.Close conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.378+09:00 level=DEBUG msg=Rows.Close conn_id=DakzQLN_ilUa3qN8 duration=625 -time=2025-02-19T08:25:13.378+09:00 level=DEBUG msg=Conn.Close conn_id=DakzQLN_ilUa3qN8 -time=2025-02-19T08:25:13.378+09:00 level=INFO msg=Conn.Close conn_id=DakzQLN_ilUa3qN8 duration=55708 +time=2025-08-06T23:24:26.072+09:00 level=TRACE msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 +time=2025-08-06T23:24:26.073+09:00 level=TRACE msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 +time=2025-08-06T23:24:26.073+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=1791 conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:26.073+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=44208 +time=2025-08-06T23:24:26.073+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:26.073+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:26.075+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=2257875 error="driver: bad connection" +time=2025-08-06T23:24:26.075+09:00 level=ERROR msg=Connector.Connect duration=2296083 error="driver: bad connection" +time=2025-08-06T23:24:26.075+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:26.075+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:26.076+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=1240208 error="driver: bad connection" +time=2025-08-06T23:24:26.076+09:00 level=ERROR msg=Connector.Connect duration=1263291 error="driver: bad connection" +time=2025-08-06T23:24:26.076+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:26.076+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:26.077+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=667000 error="driver: bad connection" +time=2025-08-06T23:24:26.077+09:00 level=ERROR msg=Connector.Connect duration=677000 error="driver: bad connection" +time=2025-08-06T23:24:28.078+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:28.078+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:28.080+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=1639000 error="driver: bad connection" +time=2025-08-06T23:24:28.080+09:00 level=ERROR msg=Connector.Connect duration=1679500 error="driver: bad connection" +time=2025-08-06T23:24:28.080+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:28.080+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:28.081+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=896542 error="driver: bad connection" +time=2025-08-06T23:24:28.081+09:00 level=ERROR msg=Connector.Connect duration=919709 error="driver: bad connection" +time=2025-08-06T23:24:28.081+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:28.081+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:28.081+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=728625 error="driver: bad connection" +time=2025-08-06T23:24:28.081+09:00 level=ERROR msg=Connector.Connect duration=741417 error="driver: bad connection" +time=2025-08-06T23:24:30.082+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:30.083+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:30.084+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=1314417 error="driver: bad connection" +time=2025-08-06T23:24:30.084+09:00 level=ERROR msg=Connector.Connect duration=1389833 error="driver: bad connection" +time=2025-08-06T23:24:30.084+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:30.084+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:30.084+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=442416 error="driver: bad connection" +time=2025-08-06T23:24:30.084+09:00 level=ERROR msg=Connector.Connect duration=467583 error="driver: bad connection" +time=2025-08-06T23:24:30.084+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:30.084+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:30.085+09:00 level=ERROR msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=406833 error="driver: bad connection" +time=2025-08-06T23:24:30.085+09:00 level=ERROR msg=Connector.Connect duration=452583 error="driver: bad connection" +time=2025-08-06T23:24:32.086+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:32.086+09:00 level=TRACE msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:32.090+09:00 level=INFO msg=Connector.Connect conn_id=reWaqdYvKTj5sOEB duration=3710084 +time=2025-08-06T23:24:32.090+09:00 level=INFO msg=Connector.Connect duration=3784875 +time=2025-08-06T23:24:32.090+09:00 level=TRACE msg=Conn.Ping conn_id=reWaqdYvKTj5sOEB duration=393583 +time=2025-08-06T23:24:32.090+09:00 level=TRACE msg=Conn.ResetSession conn_id=reWaqdYvKTj5sOEB duration=2750 +time=2025-08-06T23:24:32.090+09:00 level=TRACE msg=Conn.ExecContext conn_id=reWaqdYvKTj5sOEB query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:24:32.106+09:00 level=INFO msg=Conn.ExecContext conn_id=reWaqdYvKTj5sOEB query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=15972375 +time=2025-08-06T23:24:32.106+09:00 level=TRACE msg=Conn.ResetSession conn_id=reWaqdYvKTj5sOEB duration=5041 +time=2025-08-06T23:24:32.107+09:00 level=TRACE msg=Conn.Ping conn_id=reWaqdYvKTj5sOEB duration=343125 +time=2025-08-06T23:24:32.107+09:00 level=TRACE msg=Conn.ResetSession conn_id=reWaqdYvKTj5sOEB duration=2125 +time=2025-08-06T23:24:32.107+09:00 level=TRACE msg=Conn.BeginTx conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:32.107+09:00 level=INFO msg=Conn.BeginTx conn_id=reWaqdYvKTj5sOEB duration=272958 tx_id=YhAZhiHVE3IPShAc +time=2025-08-06T23:24:32.107+09:00 level=TRACE msg=Conn.ExecContext conn_id=reWaqdYvKTj5sOEB query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" +time=2025-08-06T23:24:32.107+09:00 level=INFO msg=Conn.ExecContext conn_id=reWaqdYvKTj5sOEB query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" duration=1916 skip=true +time=2025-08-06T23:24:32.109+09:00 level=TRACE msg=Conn.PrepareContext conn_id=reWaqdYvKTj5sOEB query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=2169834 stmt_id=pdtww8qTfHJSRI1_ +time=2025-08-06T23:24:32.110+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=reWaqdYvKTj5sOEB stmt_id=pdtww8qTfHJSRI1_ args="[1,\"Alice\"]" duration=279166 +time=2025-08-06T23:24:32.110+09:00 level=DEBUG msg=Stmt.Close conn_id=reWaqdYvKTj5sOEB stmt_id=pdtww8qTfHJSRI1_ duration=5291 +time=2025-08-06T23:24:32.110+09:00 level=TRACE msg=Tx.Commit conn_id=reWaqdYvKTj5sOEB tx_id=YhAZhiHVE3IPShAc +time=2025-08-06T23:24:32.111+09:00 level=INFO msg=Tx.Commit conn_id=reWaqdYvKTj5sOEB tx_id=YhAZhiHVE3IPShAc duration=1198792 +time=2025-08-06T23:24:32.111+09:00 level=TRACE msg=Conn.ResetSession conn_id=reWaqdYvKTj5sOEB duration=1708 +time=2025-08-06T23:24:32.111+09:00 level=TRACE msg=Conn.QueryContext conn_id=reWaqdYvKTj5sOEB query="SELECT * FROM test1" args=[] +time=2025-08-06T23:24:32.111+09:00 level=DEBUG msg=Conn.QueryContext conn_id=reWaqdYvKTj5sOEB query="SELECT * FROM test1" args=[] duration=278250 +time=2025-08-06T23:24:32.111+09:00 level=DEBUG msg=Rows.Next conn_id=reWaqdYvKTj5sOEB duration=1583 eof=false +time=2025-08-06T23:24:32.111+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:32.111+09:00 level=DEBUG msg=Rows.Next conn_id=reWaqdYvKTj5sOEB duration=83 eof=true +time=2025-08-06T23:24:32.111+09:00 level=DEBUG msg=Rows.Close conn_id=reWaqdYvKTj5sOEB duration=42 +time=2025-08-06T23:24:32.111+09:00 level=TRACE msg=Conn.Close conn_id=reWaqdYvKTj5sOEB +time=2025-08-06T23:24:32.111+09:00 level=INFO msg=Conn.Close conn_id=reWaqdYvKTj5sOEB duration=19000 diff --git a/examples/logs-mysql/results/verbose-log.json b/examples/logs-mysql/results/verbose-log.json index e2ea404..4c62cd3 100644 --- a/examples/logs-mysql/results/verbose-log.json +++ b/examples/logs-mysql/results/verbose-log.json @@ -1,81 +1,81 @@ -{"time":"2025-02-19T08:25:22.45015+09:00","level":"DEBUG","msg":"Open","driver":"mysql","dsn":"root@tcp(localhost:3306)/app1"} -{"time":"2025-02-19T08:25:22.450638+09:00","level":"DEBUG","msg":"Driver.OpenConnector","dsn":"root@tcp(localhost:3306)/app1"} -{"time":"2025-02-19T08:25:22.450681+09:00","level":"INFO","msg":"Driver.OpenConnector","dsn":"root@tcp(localhost:3306)/app1","duration":2708,"conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:22.450706+09:00","level":"INFO","msg":"Open","driver":"mysql","dsn":"root@tcp(localhost:3306)/app1","duration":182875} -{"time":"2025-02-19T08:25:22.450727+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:22.450735+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:22.453242+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":2482709,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:22.453298+09:00","level":"ERROR","msg":"Connector.Connect","duration":2561208,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:22.45331+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:22.453318+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:22.453978+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":649750,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:22.454002+09:00","level":"ERROR","msg":"Connector.Connect","duration":682500,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:22.454011+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:22.454019+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:22.454536+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":498875,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:22.45457+09:00","level":"ERROR","msg":"Connector.Connect","duration":547875,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.455673+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:24.455858+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:24.459087+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":3182625,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.459165+09:00","level":"ERROR","msg":"Connector.Connect","duration":3302709,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.459186+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:24.459205+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:24.460775+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":1548959,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.460827+09:00","level":"ERROR","msg":"Connector.Connect","duration":1617125,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.460847+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:24.460864+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:24.462354+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":1464833,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:24.462431+09:00","level":"ERROR","msg":"Connector.Connect","duration":1562125,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.462813+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:26.462986+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:26.465019+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":1947209,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.465067+09:00","level":"ERROR","msg":"Connector.Connect","duration":2087958,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.465105+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:26.465112+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:26.465831+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":709750,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.465895+09:00","level":"ERROR","msg":"Connector.Connect","duration":774417,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.465958+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:26.465983+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:26.466559+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":567167,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:26.466571+09:00","level":"ERROR","msg":"Connector.Connect","duration":587000,"error":"driver: bad connection"} -{"time":"2025-02-19T08:25:28.467657+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:25:28.467778+09:00","level":"DEBUG","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.473066+09:00","level":"INFO","msg":"Connector.Connect","conn_id":"gUAAxHgPxWhrp2JF","duration":5234417} -{"time":"2025-02-19T08:25:28.473163+09:00","level":"INFO","msg":"Connector.Connect","duration":5383875} -{"time":"2025-02-19T08:25:28.473214+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.474065+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"gUAAxHgPxWhrp2JF","duration":822000} -{"time":"2025-02-19T08:25:28.474134+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.474176+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF","duration":10458} -{"time":"2025-02-19T08:25:28.474222+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","query":"CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))","args":"[]"} -{"time":"2025-02-19T08:25:28.494326+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","query":"CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":20028084} -{"time":"2025-02-19T08:25:28.494417+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.494459+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF","duration":12500} -{"time":"2025-02-19T08:25:28.494483+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.495083+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"gUAAxHgPxWhrp2JF","duration":579417} -{"time":"2025-02-19T08:25:28.495116+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.495138+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF","duration":4709} -{"time":"2025-02-19T08:25:28.495162+09:00","level":"DEBUG","msg":"Conn.BeginTx","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.495746+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"gUAAxHgPxWhrp2JF","duration":561708,"tx_id":"W46GMOOLwIxg57YM"} -{"time":"2025-02-19T08:25:28.49591+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]"} -{"time":"2025-02-19T08:25:28.495946+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]","duration":1250,"skip":true} -{"time":"2025-02-19T08:25:28.49597+09:00","level":"DEBUG","msg":"Conn.PrepareContext","conn_id":"gUAAxHgPxWhrp2JF","query":"INSERT INTO test1 (id, name) VALUES (?, ?)"} -{"time":"2025-02-19T08:25:28.499284+09:00","level":"INFO","msg":"Conn.PrepareContext","conn_id":"gUAAxHgPxWhrp2JF","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","duration":3277250,"stmt_id":"mblHF05jWxqjhG9M"} -{"time":"2025-02-19T08:25:28.499414+09:00","level":"DEBUG","msg":"Stmt.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","stmt_id":"mblHF05jWxqjhG9M","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]"} -{"time":"2025-02-19T08:25:28.499952+09:00","level":"INFO","msg":"Stmt.ExecContext","conn_id":"gUAAxHgPxWhrp2JF","stmt_id":"mblHF05jWxqjhG9M","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]","duration":505125} -{"time":"2025-02-19T08:25:28.499986+09:00","level":"DEBUG","msg":"Stmt.Close","conn_id":"gUAAxHgPxWhrp2JF","stmt_id":"mblHF05jWxqjhG9M"} -{"time":"2025-02-19T08:25:28.500029+09:00","level":"INFO","msg":"Stmt.Close","conn_id":"gUAAxHgPxWhrp2JF","stmt_id":"mblHF05jWxqjhG9M","duration":22167} -{"time":"2025-02-19T08:25:28.500063+09:00","level":"DEBUG","msg":"Tx.Commit","conn_id":"gUAAxHgPxWhrp2JF","tx_id":"W46GMOOLwIxg57YM"} -{"time":"2025-02-19T08:25:28.50162+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"gUAAxHgPxWhrp2JF","tx_id":"W46GMOOLwIxg57YM","duration":1531875} -{"time":"2025-02-19T08:25:28.501653+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.501675+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"gUAAxHgPxWhrp2JF","duration":4125} -{"time":"2025-02-19T08:25:28.5017+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"gUAAxHgPxWhrp2JF","query":"SELECT * FROM test1","args":"[]"} -{"time":"2025-02-19T08:25:28.502251+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"gUAAxHgPxWhrp2JF","query":"SELECT * FROM test1","args":"[]","duration":528125} -{"time":"2025-02-19T08:25:28.502278+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.502316+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"gUAAxHgPxWhrp2JF","duration":26334,"eof":false} -{"time":"2025-02-19T08:25:28.502362+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} -{"time":"2025-02-19T08:25:28.502378+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.502388+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"gUAAxHgPxWhrp2JF","duration":250,"eof":true} -{"time":"2025-02-19T08:25:28.502399+09:00","level":"TRACE","msg":"Rows.Close","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.502407+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"gUAAxHgPxWhrp2JF","duration":500} -{"time":"2025-02-19T08:25:28.502423+09:00","level":"DEBUG","msg":"Conn.Close","conn_id":"gUAAxHgPxWhrp2JF"} -{"time":"2025-02-19T08:25:28.502483+09:00","level":"INFO","msg":"Conn.Close","conn_id":"gUAAxHgPxWhrp2JF","duration":50542} +{"time":"2025-08-06T23:24:41.877871+09:00","level":"TRACE","msg":"Open","driver":"mysql","dsn":"root@tcp(localhost:3306)/app1"} +{"time":"2025-08-06T23:24:41.878054+09:00","level":"TRACE","msg":"Driver.OpenConnector","dsn":"root@tcp(localhost:3306)/app1"} +{"time":"2025-08-06T23:24:41.878062+09:00","level":"INFO","msg":"Driver.OpenConnector","dsn":"root@tcp(localhost:3306)/app1","duration":1625,"conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:41.878069+09:00","level":"INFO","msg":"Open","driver":"mysql","dsn":"root@tcp(localhost:3306)/app1","duration":51667} +{"time":"2025-08-06T23:24:41.878075+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:41.878078+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:41.88049+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":2403750,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:41.880506+09:00","level":"ERROR","msg":"Connector.Connect","duration":2427583,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:41.880511+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:41.880514+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:41.881278+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":758459,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:41.881302+09:00","level":"ERROR","msg":"Connector.Connect","duration":785333,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:41.881309+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:41.881312+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:41.881832+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":516208,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:41.881837+09:00","level":"ERROR","msg":"Connector.Connect","duration":524291,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.882888+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:43.882953+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:43.884604+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":1634041,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.884625+09:00","level":"ERROR","msg":"Connector.Connect","duration":1670791,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.884632+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:43.884636+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:43.885634+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":985250,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.88847+09:00","level":"ERROR","msg":"Connector.Connect","duration":3826875,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.888487+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:43.888491+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:43.890238+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":1740291,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:43.890255+09:00","level":"ERROR","msg":"Connector.Connect","duration":1763125,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.891645+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:45.891735+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:45.893756+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":1995291,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.893782+09:00","level":"ERROR","msg":"Connector.Connect","duration":2048167,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.893799+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:45.893803+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:45.894784+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":964333,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.894797+09:00","level":"ERROR","msg":"Connector.Connect","duration":994042,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.894801+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:45.894803+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:45.895773+09:00","level":"ERROR","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":957667,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:45.89581+09:00","level":"ERROR","msg":"Connector.Connect","duration":1004625,"error":"driver: bad connection"} +{"time":"2025-08-06T23:24:47.896942+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:47.897868+09:00","level":"TRACE","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.901816+09:00","level":"INFO","msg":"Connector.Connect","conn_id":"6ZZBD2D3aDGwhNkE","duration":3911083} +{"time":"2025-08-06T23:24:47.901851+09:00","level":"INFO","msg":"Connector.Connect","duration":3982666} +{"time":"2025-08-06T23:24:47.901865+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.902186+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"6ZZBD2D3aDGwhNkE","duration":309292} +{"time":"2025-08-06T23:24:47.902205+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.902218+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE","duration":3667} +{"time":"2025-08-06T23:24:47.902228+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))","args":"[]"} +{"time":"2025-08-06T23:24:47.915704+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":13452750} +{"time":"2025-08-06T23:24:47.915743+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.915755+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE","duration":3625} +{"time":"2025-08-06T23:24:47.915762+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.916125+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"6ZZBD2D3aDGwhNkE","duration":355458} +{"time":"2025-08-06T23:24:47.916137+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.916144+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE","duration":1083} +{"time":"2025-08-06T23:24:47.916151+09:00","level":"TRACE","msg":"Conn.BeginTx","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.916831+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"6ZZBD2D3aDGwhNkE","duration":672666,"tx_id":"Bl9m5Xa70tXlAuwe"} +{"time":"2025-08-06T23:24:47.916863+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","args":"[1,\"Alice\"]"} +{"time":"2025-08-06T23:24:47.916879+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","args":"[1,\"Alice\"]","duration":459,"skip":true} +{"time":"2025-08-06T23:24:47.916886+09:00","level":"VERBOSE","msg":"Conn.PrepareContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"INSERT INTO test1 (id, name) VALUES (?, ?)"} +{"time":"2025-08-06T23:24:47.919917+09:00","level":"TRACE","msg":"Conn.PrepareContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"INSERT INTO test1 (id, name) VALUES (?, ?)","duration":3011083,"stmt_id":"_FmR8mX4J88SSrAb"} +{"time":"2025-08-06T23:24:47.919969+09:00","level":"VERBOSE","msg":"Stmt.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","stmt_id":"_FmR8mX4J88SSrAb","args":"[1,\"Alice\"]"} +{"time":"2025-08-06T23:24:47.920364+09:00","level":"DEBUG","msg":"Stmt.ExecContext","conn_id":"6ZZBD2D3aDGwhNkE","stmt_id":"_FmR8mX4J88SSrAb","args":"[1,\"Alice\"]","duration":389042} +{"time":"2025-08-06T23:24:47.920377+09:00","level":"VERBOSE","msg":"Stmt.Close","conn_id":"6ZZBD2D3aDGwhNkE","stmt_id":"_FmR8mX4J88SSrAb"} +{"time":"2025-08-06T23:24:47.920389+09:00","level":"DEBUG","msg":"Stmt.Close","conn_id":"6ZZBD2D3aDGwhNkE","stmt_id":"_FmR8mX4J88SSrAb","duration":6333} +{"time":"2025-08-06T23:24:47.9204+09:00","level":"TRACE","msg":"Tx.Commit","conn_id":"6ZZBD2D3aDGwhNkE","tx_id":"Bl9m5Xa70tXlAuwe"} +{"time":"2025-08-06T23:24:47.923121+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"6ZZBD2D3aDGwhNkE","tx_id":"Bl9m5Xa70tXlAuwe","duration":2710542} +{"time":"2025-08-06T23:24:47.923133+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.923141+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"6ZZBD2D3aDGwhNkE","duration":2583} +{"time":"2025-08-06T23:24:47.923152+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"SELECT * FROM test1","args":"[]"} +{"time":"2025-08-06T23:24:47.923444+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"6ZZBD2D3aDGwhNkE","query":"SELECT * FROM test1","args":"[]","duration":285291} +{"time":"2025-08-06T23:24:47.923455+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.923464+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"6ZZBD2D3aDGwhNkE","duration":1250,"eof":false} +{"time":"2025-08-06T23:24:47.923478+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} +{"time":"2025-08-06T23:24:47.923483+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.923487+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"6ZZBD2D3aDGwhNkE","duration":84,"eof":true} +{"time":"2025-08-06T23:24:47.92349+09:00","level":"VERBOSE","msg":"Rows.Close","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.923494+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"6ZZBD2D3aDGwhNkE","duration":291} +{"time":"2025-08-06T23:24:47.9235+09:00","level":"TRACE","msg":"Conn.Close","conn_id":"6ZZBD2D3aDGwhNkE"} +{"time":"2025-08-06T23:24:47.923519+09:00","level":"INFO","msg":"Conn.Close","conn_id":"6ZZBD2D3aDGwhNkE","duration":15875} diff --git a/examples/logs-mysql/results/verbose-log.txt b/examples/logs-mysql/results/verbose-log.txt index 763e6a3..b79c3a9 100644 --- a/examples/logs-mysql/results/verbose-log.txt +++ b/examples/logs-mysql/results/verbose-log.txt @@ -1,81 +1,81 @@ -time=2025-02-19T08:25:14.804+09:00 level=DEBUG msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:25:14.805+09:00 level=DEBUG msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 -time=2025-02-19T08:25:14.805+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=3250 conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:14.805+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=185541 -time=2025-02-19T08:25:14.805+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:14.805+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:14.808+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=3073750 error="driver: bad connection" -time=2025-02-19T08:25:14.808+09:00 level=ERROR msg=Connector.Connect duration=3108791 error="driver: bad connection" -time=2025-02-19T08:25:14.808+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:14.808+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:14.808+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=542333 error="driver: bad connection" -time=2025-02-19T08:25:14.808+09:00 level=ERROR msg=Connector.Connect duration=559166 error="driver: bad connection" -time=2025-02-19T08:25:14.808+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:14.808+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:14.809+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=497000 error="driver: bad connection" -time=2025-02-19T08:25:14.809+09:00 level=ERROR msg=Connector.Connect duration=507250 error="driver: bad connection" -time=2025-02-19T08:25:16.810+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:16.810+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:16.813+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=2465250 error="driver: bad connection" -time=2025-02-19T08:25:16.813+09:00 level=ERROR msg=Connector.Connect duration=2670667 error="driver: bad connection" -time=2025-02-19T08:25:16.813+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:16.813+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:16.814+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=1436375 error="driver: bad connection" -time=2025-02-19T08:25:16.815+09:00 level=ERROR msg=Connector.Connect duration=1563333 error="driver: bad connection" -time=2025-02-19T08:25:16.815+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:16.815+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:16.815+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=900250 error="driver: bad connection" -time=2025-02-19T08:25:16.816+09:00 level=ERROR msg=Connector.Connect duration=978042 error="driver: bad connection" -time=2025-02-19T08:25:18.817+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:18.817+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:18.819+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=2300125 error="driver: bad connection" -time=2025-02-19T08:25:18.819+09:00 level=ERROR msg=Connector.Connect duration=2415375 error="driver: bad connection" -time=2025-02-19T08:25:18.819+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:18.819+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:18.820+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=1187042 error="driver: bad connection" -time=2025-02-19T08:25:18.821+09:00 level=ERROR msg=Connector.Connect duration=1267417 error="driver: bad connection" -time=2025-02-19T08:25:18.821+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:18.821+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:18.822+09:00 level=ERROR msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=1109000 error="driver: bad connection" -time=2025-02-19T08:25:18.822+09:00 level=ERROR msg=Connector.Connect duration=1237666 error="driver: bad connection" -time=2025-02-19T08:25:20.823+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:25:20.823+09:00 level=DEBUG msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.827+09:00 level=INFO msg=Connector.Connect conn_id=SU8sW4BPEzVZjdTJ duration=4345958 -time=2025-02-19T08:25:20.827+09:00 level=INFO msg=Connector.Connect duration=4394167 -time=2025-02-19T08:25:20.827+09:00 level=VERBOSE msg=Conn.Ping conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.828+09:00 level=TRACE msg=Conn.Ping conn_id=SU8sW4BPEzVZjdTJ duration=461959 -time=2025-02-19T08:25:20.828+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.828+09:00 level=TRACE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ duration=3250 -time=2025-02-19T08:25:20.828+09:00 level=DEBUG msg=Conn.ExecContext conn_id=SU8sW4BPEzVZjdTJ query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:25:20.842+09:00 level=INFO msg=Conn.ExecContext conn_id=SU8sW4BPEzVZjdTJ query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=13984875 -time=2025-02-19T08:25:20.842+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.842+09:00 level=TRACE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ duration=1500 -time=2025-02-19T08:25:20.842+09:00 level=VERBOSE msg=Conn.Ping conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.842+09:00 level=TRACE msg=Conn.Ping conn_id=SU8sW4BPEzVZjdTJ duration=439083 -time=2025-02-19T08:25:20.842+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.842+09:00 level=TRACE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ duration=1208 -time=2025-02-19T08:25:20.842+09:00 level=DEBUG msg=Conn.BeginTx conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.843+09:00 level=INFO msg=Conn.BeginTx conn_id=SU8sW4BPEzVZjdTJ duration=424916 tx_id=dIFS6F1jIefQfKX7 -time=2025-02-19T08:25:20.843+09:00 level=DEBUG msg=Conn.ExecContext conn_id=SU8sW4BPEzVZjdTJ query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:20.843+09:00 level=INFO msg=Conn.ExecContext conn_id=SU8sW4BPEzVZjdTJ query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=459 skip=true -time=2025-02-19T08:25:20.843+09:00 level=DEBUG msg=Conn.PrepareContext conn_id=SU8sW4BPEzVZjdTJ query="INSERT INTO test1 (id, name) VALUES (?, ?)" -time=2025-02-19T08:25:20.845+09:00 level=INFO msg=Conn.PrepareContext conn_id=SU8sW4BPEzVZjdTJ query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=2325417 stmt_id=QINlqBJWBcghK4E1 -time=2025-02-19T08:25:20.845+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=SU8sW4BPEzVZjdTJ stmt_id=QINlqBJWBcghK4E1 args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:25:20.846+09:00 level=INFO msg=Stmt.ExecContext conn_id=SU8sW4BPEzVZjdTJ stmt_id=QINlqBJWBcghK4E1 args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=503416 -time=2025-02-19T08:25:20.846+09:00 level=DEBUG msg=Stmt.Close conn_id=SU8sW4BPEzVZjdTJ stmt_id=QINlqBJWBcghK4E1 -time=2025-02-19T08:25:20.846+09:00 level=INFO msg=Stmt.Close conn_id=SU8sW4BPEzVZjdTJ stmt_id=QINlqBJWBcghK4E1 duration=7500 -time=2025-02-19T08:25:20.846+09:00 level=DEBUG msg=Tx.Commit conn_id=SU8sW4BPEzVZjdTJ tx_id=dIFS6F1jIefQfKX7 -time=2025-02-19T08:25:20.847+09:00 level=INFO msg=Tx.Commit conn_id=SU8sW4BPEzVZjdTJ tx_id=dIFS6F1jIefQfKX7 duration=1531459 -time=2025-02-19T08:25:20.847+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.847+09:00 level=TRACE msg=Conn.ResetSession conn_id=SU8sW4BPEzVZjdTJ duration=1416 -time=2025-02-19T08:25:20.847+09:00 level=TRACE msg=Conn.QueryContext conn_id=SU8sW4BPEzVZjdTJ query="SELECT * FROM test1" args=[] -time=2025-02-19T08:25:20.848+09:00 level=DEBUG msg=Conn.QueryContext conn_id=SU8sW4BPEzVZjdTJ query="SELECT * FROM test1" args=[] duration=552500 -time=2025-02-19T08:25:20.848+09:00 level=TRACE msg=Rows.Next conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.848+09:00 level=DEBUG msg=Rows.Next conn_id=SU8sW4BPEzVZjdTJ duration=19875 eof=false -time=2025-02-19T08:25:20.848+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:25:20.848+09:00 level=TRACE msg=Rows.Next conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.848+09:00 level=DEBUG msg=Rows.Next conn_id=SU8sW4BPEzVZjdTJ duration=250 eof=true -time=2025-02-19T08:25:20.848+09:00 level=TRACE msg=Rows.Close conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.848+09:00 level=DEBUG msg=Rows.Close conn_id=SU8sW4BPEzVZjdTJ duration=333 -time=2025-02-19T08:25:20.848+09:00 level=DEBUG msg=Conn.Close conn_id=SU8sW4BPEzVZjdTJ -time=2025-02-19T08:25:20.848+09:00 level=INFO msg=Conn.Close conn_id=SU8sW4BPEzVZjdTJ duration=20125 +time=2025-08-06T23:24:33.949+09:00 level=TRACE msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 +time=2025-08-06T23:24:33.949+09:00 level=TRACE msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 +time=2025-08-06T23:24:33.949+09:00 level=INFO msg=Driver.OpenConnector dsn=root@tcp(localhost:3306)/app1 duration=1792 conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:33.949+09:00 level=INFO msg=Open driver=mysql dsn=root@tcp(localhost:3306)/app1 duration=42583 +time=2025-08-06T23:24:33.949+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:33.949+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:33.952+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=2480125 error="driver: bad connection" +time=2025-08-06T23:24:33.952+09:00 level=ERROR msg=Connector.Connect duration=2506625 error="driver: bad connection" +time=2025-08-06T23:24:33.952+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:33.952+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:33.952+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=563084 error="driver: bad connection" +time=2025-08-06T23:24:33.952+09:00 level=ERROR msg=Connector.Connect duration=582000 error="driver: bad connection" +time=2025-08-06T23:24:33.952+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:33.952+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:33.953+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=513250 error="driver: bad connection" +time=2025-08-06T23:24:33.953+09:00 level=ERROR msg=Connector.Connect duration=540334 error="driver: bad connection" +time=2025-08-06T23:24:35.954+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:35.954+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:35.955+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=922667 error="driver: bad connection" +time=2025-08-06T23:24:35.955+09:00 level=ERROR msg=Connector.Connect duration=1008291 error="driver: bad connection" +time=2025-08-06T23:24:35.955+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:35.955+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:35.956+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=707417 error="driver: bad connection" +time=2025-08-06T23:24:35.956+09:00 level=ERROR msg=Connector.Connect duration=752917 error="driver: bad connection" +time=2025-08-06T23:24:35.956+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:35.956+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:35.956+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=480584 error="driver: bad connection" +time=2025-08-06T23:24:35.956+09:00 level=ERROR msg=Connector.Connect duration=521292 error="driver: bad connection" +time=2025-08-06T23:24:37.957+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:37.957+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:37.960+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=2992167 error="driver: bad connection" +time=2025-08-06T23:24:37.960+09:00 level=ERROR msg=Connector.Connect duration=3058083 error="driver: bad connection" +time=2025-08-06T23:24:37.960+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:37.960+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:37.961+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=1053416 error="driver: bad connection" +time=2025-08-06T23:24:37.961+09:00 level=ERROR msg=Connector.Connect duration=1084000 error="driver: bad connection" +time=2025-08-06T23:24:37.961+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:37.961+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:37.962+09:00 level=ERROR msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=466333 error="driver: bad connection" +time=2025-08-06T23:24:37.962+09:00 level=ERROR msg=Connector.Connect duration=485625 error="driver: bad connection" +time=2025-08-06T23:24:39.963+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:39.963+09:00 level=TRACE msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.966+09:00 level=INFO msg=Connector.Connect conn_id=4a8TXRbcAWVHSvua duration=3371958 +time=2025-08-06T23:24:39.966+09:00 level=INFO msg=Connector.Connect duration=3437125 +time=2025-08-06T23:24:39.966+09:00 level=VERBOSE msg=Conn.Ping conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.967+09:00 level=TRACE msg=Conn.Ping conn_id=4a8TXRbcAWVHSvua duration=332417 +time=2025-08-06T23:24:39.967+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.967+09:00 level=TRACE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua duration=3084 +time=2025-08-06T23:24:39.967+09:00 level=TRACE msg=Conn.ExecContext conn_id=4a8TXRbcAWVHSvua query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:24:39.983+09:00 level=INFO msg=Conn.ExecContext conn_id=4a8TXRbcAWVHSvua query="CREATE TABLE IF NOT EXISTS test1 (id INT PRIMARY KEY, name VARCHAR(255))" args=[] duration=16739166 +time=2025-08-06T23:24:39.983+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.983+09:00 level=TRACE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua duration=2541 +time=2025-08-06T23:24:39.983+09:00 level=VERBOSE msg=Conn.Ping conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.984+09:00 level=TRACE msg=Conn.Ping conn_id=4a8TXRbcAWVHSvua duration=339666 +time=2025-08-06T23:24:39.984+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.984+09:00 level=TRACE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua duration=1709 +time=2025-08-06T23:24:39.984+09:00 level=TRACE msg=Conn.BeginTx conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.984+09:00 level=INFO msg=Conn.BeginTx conn_id=4a8TXRbcAWVHSvua duration=345834 tx_id=XBXE_cuLi29Uelvm +time=2025-08-06T23:24:39.984+09:00 level=TRACE msg=Conn.ExecContext conn_id=4a8TXRbcAWVHSvua query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" +time=2025-08-06T23:24:39.984+09:00 level=INFO msg=Conn.ExecContext conn_id=4a8TXRbcAWVHSvua query="INSERT INTO test1 (id, name) VALUES (?, ?)" args="[1,\"Alice\"]" duration=750 skip=true +time=2025-08-06T23:24:39.984+09:00 level=VERBOSE msg=Conn.PrepareContext conn_id=4a8TXRbcAWVHSvua query="INSERT INTO test1 (id, name) VALUES (?, ?)" +time=2025-08-06T23:24:39.989+09:00 level=TRACE msg=Conn.PrepareContext conn_id=4a8TXRbcAWVHSvua query="INSERT INTO test1 (id, name) VALUES (?, ?)" duration=5120166 stmt_id=k5sjvbiyBnPBBGl7 +time=2025-08-06T23:24:39.989+09:00 level=VERBOSE msg=Stmt.ExecContext conn_id=4a8TXRbcAWVHSvua stmt_id=k5sjvbiyBnPBBGl7 args="[1,\"Alice\"]" +time=2025-08-06T23:24:39.990+09:00 level=DEBUG msg=Stmt.ExecContext conn_id=4a8TXRbcAWVHSvua stmt_id=k5sjvbiyBnPBBGl7 args="[1,\"Alice\"]" duration=339000 +time=2025-08-06T23:24:39.990+09:00 level=VERBOSE msg=Stmt.Close conn_id=4a8TXRbcAWVHSvua stmt_id=k5sjvbiyBnPBBGl7 +time=2025-08-06T23:24:39.990+09:00 level=DEBUG msg=Stmt.Close conn_id=4a8TXRbcAWVHSvua stmt_id=k5sjvbiyBnPBBGl7 duration=5709 +time=2025-08-06T23:24:39.990+09:00 level=TRACE msg=Tx.Commit conn_id=4a8TXRbcAWVHSvua tx_id=XBXE_cuLi29Uelvm +time=2025-08-06T23:24:39.991+09:00 level=INFO msg=Tx.Commit conn_id=4a8TXRbcAWVHSvua tx_id=XBXE_cuLi29Uelvm duration=1433625 +time=2025-08-06T23:24:39.991+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.991+09:00 level=TRACE msg=Conn.ResetSession conn_id=4a8TXRbcAWVHSvua duration=2792 +time=2025-08-06T23:24:39.991+09:00 level=TRACE msg=Conn.QueryContext conn_id=4a8TXRbcAWVHSvua query="SELECT * FROM test1" args=[] +time=2025-08-06T23:24:39.992+09:00 level=DEBUG msg=Conn.QueryContext conn_id=4a8TXRbcAWVHSvua query="SELECT * FROM test1" args=[] duration=364875 +time=2025-08-06T23:24:39.992+09:00 level=VERBOSE msg=Rows.Next conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.992+09:00 level=DEBUG msg=Rows.Next conn_id=4a8TXRbcAWVHSvua duration=2458 eof=false +time=2025-08-06T23:24:39.992+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:39.992+09:00 level=VERBOSE msg=Rows.Next conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.992+09:00 level=DEBUG msg=Rows.Next conn_id=4a8TXRbcAWVHSvua duration=208 eof=true +time=2025-08-06T23:24:39.992+09:00 level=VERBOSE msg=Rows.Close conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.992+09:00 level=DEBUG msg=Rows.Close conn_id=4a8TXRbcAWVHSvua duration=208 +time=2025-08-06T23:24:39.992+09:00 level=TRACE msg=Conn.Close conn_id=4a8TXRbcAWVHSvua +time=2025-08-06T23:24:39.992+09:00 level=INFO msg=Conn.Close conn_id=4a8TXRbcAWVHSvua duration=26541 diff --git a/examples/logs-postgres/results/debug-log.txt b/examples/logs-postgres/results/debug-log.txt index e27c9ba..07a8dfb 100644 --- a/examples/logs-postgres/results/debug-log.txt +++ b/examples/logs-postgres/results/debug-log.txt @@ -1,25 +1,15 @@ -time=2025-02-19T08:24:40.817+09:00 level=DEBUG msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:40.817+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=45083 -time=2025-02-19T08:24:40.817+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:40.817+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:40.818+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=954417 error=EOF -time=2025-02-19T08:24:40.818+09:00 level=ERROR msg=Connector.Connect duration=1010458 error=EOF -time=2025-02-19T08:24:42.819+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:42.820+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:42.833+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=12936959 conn_id=61Ugc1c8J8pgxWj8 -time=2025-02-19T08:24:42.833+09:00 level=INFO msg=Connector.Connect duration=13163125 -time=2025-02-19T08:24:42.833+09:00 level=DEBUG msg=Conn.ExecContext conn_id=61Ugc1c8J8pgxWj8 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:42.838+09:00 level=INFO msg=Conn.ExecContext conn_id=61Ugc1c8J8pgxWj8 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4154125 -time=2025-02-19T08:24:42.838+09:00 level=DEBUG msg=Conn.BeginTx conn_id=61Ugc1c8J8pgxWj8 -time=2025-02-19T08:24:42.839+09:00 level=INFO msg=Conn.BeginTx conn_id=61Ugc1c8J8pgxWj8 duration=617709 tx_id=IalT4gLBWJxi4jbm -time=2025-02-19T08:24:42.839+09:00 level=DEBUG msg=Conn.ExecContext conn_id=61Ugc1c8J8pgxWj8 query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:24:42.841+09:00 level=INFO msg=Conn.ExecContext conn_id=61Ugc1c8J8pgxWj8 query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=1545375 -time=2025-02-19T08:24:42.841+09:00 level=DEBUG msg=Tx.Commit conn_id=61Ugc1c8J8pgxWj8 tx_id=IalT4gLBWJxi4jbm -time=2025-02-19T08:24:42.842+09:00 level=INFO msg=Tx.Commit conn_id=61Ugc1c8J8pgxWj8 tx_id=IalT4gLBWJxi4jbm duration=990375 -time=2025-02-19T08:24:42.843+09:00 level=DEBUG msg=Conn.QueryContext conn_id=61Ugc1c8J8pgxWj8 query="SELECT * FROM test1" args=[] duration=631292 -time=2025-02-19T08:24:42.843+09:00 level=DEBUG msg=Rows.Next conn_id=61Ugc1c8J8pgxWj8 duration=2792 eof=false -time=2025-02-19T08:24:42.843+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:42.843+09:00 level=DEBUG msg=Rows.Next conn_id=61Ugc1c8J8pgxWj8 duration=1209 eof=true -time=2025-02-19T08:24:42.843+09:00 level=DEBUG msg=Rows.Close conn_id=61Ugc1c8J8pgxWj8 duration=250 -time=2025-02-19T08:24:42.843+09:00 level=DEBUG msg=Conn.Close conn_id=61Ugc1c8J8pgxWj8 -time=2025-02-19T08:24:42.843+09:00 level=INFO msg=Conn.Close conn_id=61Ugc1c8J8pgxWj8 duration=86708 +time=2025-08-06T23:23:56.128+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=68750 +time=2025-08-06T23:23:56.129+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=788500 error="read tcp 127.0.0.1:61635->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:23:56.129+09:00 level=ERROR msg=Connector.Connect duration=819625 error="read tcp 127.0.0.1:61635->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:23:58.139+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=9617292 conn_id=R7iQY28Osd_CJyuz +time=2025-08-06T23:23:58.139+09:00 level=INFO msg=Connector.Connect duration=9788167 +time=2025-08-06T23:23:58.144+09:00 level=INFO msg=Conn.ExecContext conn_id=R7iQY28Osd_CJyuz query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=3789375 +time=2025-08-06T23:23:58.144+09:00 level=INFO msg=Conn.BeginTx conn_id=R7iQY28Osd_CJyuz duration=288792 tx_id=ACeDDgjkccTVtwMr +time=2025-08-06T23:23:58.145+09:00 level=INFO msg=Conn.ExecContext conn_id=R7iQY28Osd_CJyuz query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" duration=1136667 +time=2025-08-06T23:23:58.146+09:00 level=INFO msg=Tx.Commit conn_id=R7iQY28Osd_CJyuz tx_id=ACeDDgjkccTVtwMr duration=774750 +time=2025-08-06T23:23:58.147+09:00 level=DEBUG msg=Conn.QueryContext conn_id=R7iQY28Osd_CJyuz query="SELECT * FROM test1" args=[] duration=392292 +time=2025-08-06T23:23:58.147+09:00 level=DEBUG msg=Rows.Next conn_id=R7iQY28Osd_CJyuz duration=1584 eof=false +time=2025-08-06T23:23:58.147+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:58.147+09:00 level=DEBUG msg=Rows.Next conn_id=R7iQY28Osd_CJyuz duration=583 eof=true +time=2025-08-06T23:23:58.147+09:00 level=DEBUG msg=Rows.Close conn_id=R7iQY28Osd_CJyuz duration=42 +time=2025-08-06T23:23:58.147+09:00 level=INFO msg=Conn.Close conn_id=R7iQY28Osd_CJyuz duration=17459 diff --git a/examples/logs-postgres/results/info-log.txt b/examples/logs-postgres/results/info-log.txt index 817b634..bd69b2d 100644 --- a/examples/logs-postgres/results/info-log.txt +++ b/examples/logs-postgres/results/info-log.txt @@ -1,11 +1,11 @@ -time=2025-02-19T08:24:37.992+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=88917 -time=2025-02-19T08:24:37.994+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=1106584 error=EOF -time=2025-02-19T08:24:37.994+09:00 level=ERROR msg=Connector.Connect duration=1177042 error=EOF -time=2025-02-19T08:24:40.012+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=17772500 conn_id=VIccjsFjsJV7w21h -time=2025-02-19T08:24:40.012+09:00 level=INFO msg=Connector.Connect duration=18083208 -time=2025-02-19T08:24:40.018+09:00 level=INFO msg=Conn.ExecContext conn_id=VIccjsFjsJV7w21h query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4805208 -time=2025-02-19T08:24:40.019+09:00 level=INFO msg=Conn.BeginTx conn_id=VIccjsFjsJV7w21h duration=579334 tx_id=zPkm6sD1QPNBnYWX -time=2025-02-19T08:24:40.021+09:00 level=INFO msg=Conn.ExecContext conn_id=VIccjsFjsJV7w21h query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=1652042 -time=2025-02-19T08:24:40.023+09:00 level=INFO msg=Tx.Commit conn_id=VIccjsFjsJV7w21h tx_id=zPkm6sD1QPNBnYWX duration=1187791 -time=2025-02-19T08:24:40.023+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:40.023+09:00 level=INFO msg=Conn.Close conn_id=VIccjsFjsJV7w21h duration=66042 +time=2025-08-06T23:23:53.060+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=76416 +time=2025-08-06T23:23:53.061+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=605917 error="read tcp 127.0.0.1:61632->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:23:53.061+09:00 level=ERROR msg=Connector.Connect duration=635333 error="read tcp 127.0.0.1:61632->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:23:55.081+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=18800167 conn_id=DND7Y_XZmy77URni +time=2025-08-06T23:23:55.081+09:00 level=INFO msg=Connector.Connect duration=19007083 +time=2025-08-06T23:23:55.085+09:00 level=INFO msg=Conn.ExecContext conn_id=DND7Y_XZmy77URni query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=3010292 +time=2025-08-06T23:23:55.086+09:00 level=INFO msg=Conn.BeginTx conn_id=DND7Y_XZmy77URni duration=297875 tx_id=W2A2VLIfqrhlDGJG +time=2025-08-06T23:23:55.087+09:00 level=INFO msg=Conn.ExecContext conn_id=DND7Y_XZmy77URni query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" duration=1336083 +time=2025-08-06T23:23:55.088+09:00 level=INFO msg=Tx.Commit conn_id=DND7Y_XZmy77URni tx_id=W2A2VLIfqrhlDGJG duration=682875 +time=2025-08-06T23:23:55.088+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:55.088+09:00 level=INFO msg=Conn.Close conn_id=DND7Y_XZmy77URni duration=17250 diff --git a/examples/logs-postgres/results/trace-log.txt b/examples/logs-postgres/results/trace-log.txt index b5a7985..cfa6f2f 100644 --- a/examples/logs-postgres/results/trace-log.txt +++ b/examples/logs-postgres/results/trace-log.txt @@ -1,35 +1,32 @@ -time=2025-02-19T08:24:43.639+09:00 level=DEBUG msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:43.639+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=63250 -time=2025-02-19T08:24:43.639+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:43.639+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:43.640+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=822750 error=EOF -time=2025-02-19T08:24:43.640+09:00 level=ERROR msg=Connector.Connect duration=869666 error=EOF -time=2025-02-19T08:24:45.641+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:45.642+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:45.655+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=12805708 conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.655+09:00 level=INFO msg=Connector.Connect duration=13109083 -time=2025-02-19T08:24:45.656+09:00 level=TRACE msg=Conn.Ping conn_id=_Y6P6RDoUv3By5sG duration=679542 -time=2025-02-19T08:24:45.656+09:00 level=TRACE msg=Conn.ResetSession conn_id=_Y6P6RDoUv3By5sG duration=708 -time=2025-02-19T08:24:45.656+09:00 level=DEBUG msg=Conn.ExecContext conn_id=_Y6P6RDoUv3By5sG query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:45.660+09:00 level=INFO msg=Conn.ExecContext conn_id=_Y6P6RDoUv3By5sG query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4279750 -time=2025-02-19T08:24:45.660+09:00 level=TRACE msg=Conn.ResetSession conn_id=_Y6P6RDoUv3By5sG duration=334 -time=2025-02-19T08:24:45.661+09:00 level=TRACE msg=Conn.Ping conn_id=_Y6P6RDoUv3By5sG duration=648334 -time=2025-02-19T08:24:45.661+09:00 level=TRACE msg=Conn.ResetSession conn_id=_Y6P6RDoUv3By5sG duration=209 -time=2025-02-19T08:24:45.661+09:00 level=DEBUG msg=Conn.BeginTx conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.661+09:00 level=INFO msg=Conn.BeginTx conn_id=_Y6P6RDoUv3By5sG duration=589750 tx_id=inB6TzL5WgAXGOs6 -time=2025-02-19T08:24:45.662+09:00 level=DEBUG msg=Conn.ExecContext conn_id=_Y6P6RDoUv3By5sG query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:24:45.663+09:00 level=INFO msg=Conn.ExecContext conn_id=_Y6P6RDoUv3By5sG query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=1566625 -time=2025-02-19T08:24:45.663+09:00 level=DEBUG msg=Tx.Commit conn_id=_Y6P6RDoUv3By5sG tx_id=inB6TzL5WgAXGOs6 -time=2025-02-19T08:24:45.664+09:00 level=INFO msg=Tx.Commit conn_id=_Y6P6RDoUv3By5sG tx_id=inB6TzL5WgAXGOs6 duration=1046458 -time=2025-02-19T08:24:45.664+09:00 level=TRACE msg=Conn.ResetSession conn_id=_Y6P6RDoUv3By5sG duration=167 -time=2025-02-19T08:24:45.664+09:00 level=TRACE msg=Conn.QueryContext conn_id=_Y6P6RDoUv3By5sG query="SELECT * FROM test1" args=[] -time=2025-02-19T08:24:45.665+09:00 level=DEBUG msg=Conn.QueryContext conn_id=_Y6P6RDoUv3By5sG query="SELECT * FROM test1" args=[] duration=587375 -time=2025-02-19T08:24:45.665+09:00 level=TRACE msg=Rows.Next conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.665+09:00 level=DEBUG msg=Rows.Next conn_id=_Y6P6RDoUv3By5sG duration=3458 eof=false -time=2025-02-19T08:24:45.665+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:45.665+09:00 level=TRACE msg=Rows.Next conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.665+09:00 level=DEBUG msg=Rows.Next conn_id=_Y6P6RDoUv3By5sG duration=1125 eof=true -time=2025-02-19T08:24:45.665+09:00 level=TRACE msg=Rows.Close conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.665+09:00 level=DEBUG msg=Rows.Close conn_id=_Y6P6RDoUv3By5sG duration=416 -time=2025-02-19T08:24:45.665+09:00 level=DEBUG msg=Conn.Close conn_id=_Y6P6RDoUv3By5sG -time=2025-02-19T08:24:45.665+09:00 level=INFO msg=Conn.Close conn_id=_Y6P6RDoUv3By5sG duration=53667 +time=2025-08-06T23:23:58.972+09:00 level=TRACE msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:23:58.973+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=14875 +time=2025-08-06T23:23:58.973+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:23:58.973+09:00 level=TRACE msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:23:58.973+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=546958 error="read tcp 127.0.0.1:61639->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:23:58.973+09:00 level=ERROR msg=Connector.Connect duration=570666 error="read tcp 127.0.0.1:61639->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:24:00.974+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:00.975+09:00 level=TRACE msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:24:00.992+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=17226250 conn_id=brVzLT_MX4DoRbYL +time=2025-08-06T23:24:00.992+09:00 level=INFO msg=Connector.Connect duration=17481583 +time=2025-08-06T23:24:00.993+09:00 level=TRACE msg=Conn.Ping conn_id=brVzLT_MX4DoRbYL duration=615167 +time=2025-08-06T23:24:00.993+09:00 level=TRACE msg=Conn.ResetSession conn_id=brVzLT_MX4DoRbYL duration=1250 +time=2025-08-06T23:24:00.993+09:00 level=TRACE msg=Conn.ExecContext conn_id=brVzLT_MX4DoRbYL query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:24:00.997+09:00 level=INFO msg=Conn.ExecContext conn_id=brVzLT_MX4DoRbYL query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4647250 +time=2025-08-06T23:24:00.998+09:00 level=TRACE msg=Conn.ResetSession conn_id=brVzLT_MX4DoRbYL duration=708 +time=2025-08-06T23:24:00.998+09:00 level=TRACE msg=Conn.Ping conn_id=brVzLT_MX4DoRbYL duration=313209 +time=2025-08-06T23:24:00.998+09:00 level=TRACE msg=Conn.ResetSession conn_id=brVzLT_MX4DoRbYL duration=166 +time=2025-08-06T23:24:00.998+09:00 level=TRACE msg=Conn.BeginTx conn_id=brVzLT_MX4DoRbYL +time=2025-08-06T23:24:00.998+09:00 level=INFO msg=Conn.BeginTx conn_id=brVzLT_MX4DoRbYL duration=302167 tx_id=VyFX1vwTC50lUJKd +time=2025-08-06T23:24:00.998+09:00 level=TRACE msg=Conn.ExecContext conn_id=brVzLT_MX4DoRbYL query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" +time=2025-08-06T23:24:01.000+09:00 level=INFO msg=Conn.ExecContext conn_id=brVzLT_MX4DoRbYL query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" duration=1190209 +time=2025-08-06T23:24:01.000+09:00 level=TRACE msg=Tx.Commit conn_id=brVzLT_MX4DoRbYL tx_id=VyFX1vwTC50lUJKd +time=2025-08-06T23:24:01.001+09:00 level=INFO msg=Tx.Commit conn_id=brVzLT_MX4DoRbYL tx_id=VyFX1vwTC50lUJKd duration=1004709 +time=2025-08-06T23:24:01.001+09:00 level=TRACE msg=Conn.ResetSession conn_id=brVzLT_MX4DoRbYL duration=459 +time=2025-08-06T23:24:01.001+09:00 level=TRACE msg=Conn.QueryContext conn_id=brVzLT_MX4DoRbYL query="SELECT * FROM test1" args=[] +time=2025-08-06T23:24:01.001+09:00 level=DEBUG msg=Conn.QueryContext conn_id=brVzLT_MX4DoRbYL query="SELECT * FROM test1" args=[] duration=715958 +time=2025-08-06T23:24:01.002+09:00 level=DEBUG msg=Rows.Next conn_id=brVzLT_MX4DoRbYL duration=3625 eof=false +time=2025-08-06T23:24:01.002+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:01.002+09:00 level=DEBUG msg=Rows.Next conn_id=brVzLT_MX4DoRbYL duration=2417 eof=true +time=2025-08-06T23:24:01.002+09:00 level=DEBUG msg=Rows.Close conn_id=brVzLT_MX4DoRbYL duration=584 +time=2025-08-06T23:24:01.002+09:00 level=TRACE msg=Conn.Close conn_id=brVzLT_MX4DoRbYL +time=2025-08-06T23:24:01.002+09:00 level=INFO msg=Conn.Close conn_id=brVzLT_MX4DoRbYL duration=56250 diff --git a/examples/logs-postgres/results/verbose-log.json b/examples/logs-postgres/results/verbose-log.json index fbb4f53..a7b732c 100644 --- a/examples/logs-postgres/results/verbose-log.json +++ b/examples/logs-postgres/results/verbose-log.json @@ -1,41 +1,41 @@ -{"time":"2025-02-19T08:24:49.319057+09:00","level":"DEBUG","msg":"Open","driver":"postgres","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} -{"time":"2025-02-19T08:24:49.319365+09:00","level":"INFO","msg":"Open","driver":"postgres","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":51125} -{"time":"2025-02-19T08:24:49.319385+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:24:49.31939+09:00","level":"DEBUG","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} -{"time":"2025-02-19T08:24:49.320334+09:00","level":"ERROR","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":933875,"error":"EOF"} -{"time":"2025-02-19T08:24:49.320346+09:00","level":"ERROR","msg":"Connector.Connect","duration":955750,"error":"EOF"} -{"time":"2025-02-19T08:24:51.32145+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:24:51.321759+09:00","level":"DEBUG","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} -{"time":"2025-02-19T08:24:51.337042+09:00","level":"INFO","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":15201500,"conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.337139+09:00","level":"INFO","msg":"Connector.Connect","duration":15421750} -{"time":"2025-02-19T08:24:51.337199+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.337884+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"RxcviMP5EGYzSVUD","duration":652000} -{"time":"2025-02-19T08:24:51.33795+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.337977+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD","duration":917} -{"time":"2025-02-19T08:24:51.338012+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"RxcviMP5EGYzSVUD","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]"} -{"time":"2025-02-19T08:24:51.342165+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"RxcviMP5EGYzSVUD","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":4128250} -{"time":"2025-02-19T08:24:51.342231+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.34226+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD","duration":500} -{"time":"2025-02-19T08:24:51.342281+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.342862+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"RxcviMP5EGYzSVUD","duration":558833} -{"time":"2025-02-19T08:24:51.342922+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.342951+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD","duration":250} -{"time":"2025-02-19T08:24:51.342979+09:00","level":"DEBUG","msg":"Conn.BeginTx","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.343504+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"RxcviMP5EGYzSVUD","duration":503167,"tx_id":"7qMOih0egKGVtZbB"} -{"time":"2025-02-19T08:24:51.343633+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"RxcviMP5EGYzSVUD","query":"INSERT INTO test1 (id, name) VALUES ($1,$2);","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]"} -{"time":"2025-02-19T08:24:51.345108+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"RxcviMP5EGYzSVUD","query":"INSERT INTO test1 (id, name) VALUES ($1,$2);","args":"[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]","duration":1439166} -{"time":"2025-02-19T08:24:51.345176+09:00","level":"DEBUG","msg":"Tx.Commit","conn_id":"RxcviMP5EGYzSVUD","tx_id":"7qMOih0egKGVtZbB"} -{"time":"2025-02-19T08:24:51.346176+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"RxcviMP5EGYzSVUD","tx_id":"7qMOih0egKGVtZbB","duration":962458} -{"time":"2025-02-19T08:24:51.346279+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.346303+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"RxcviMP5EGYzSVUD","duration":208} -{"time":"2025-02-19T08:24:51.346326+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"RxcviMP5EGYzSVUD","query":"SELECT * FROM test1","args":"[]"} -{"time":"2025-02-19T08:24:51.346978+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"RxcviMP5EGYzSVUD","query":"SELECT * FROM test1","args":"[]","duration":633834} -{"time":"2025-02-19T08:24:51.34704+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.347071+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"RxcviMP5EGYzSVUD","duration":3125,"eof":false} -{"time":"2025-02-19T08:24:51.347136+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} -{"time":"2025-02-19T08:24:51.347161+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.347177+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"RxcviMP5EGYzSVUD","duration":1208,"eof":true} -{"time":"2025-02-19T08:24:51.347195+09:00","level":"TRACE","msg":"Rows.Close","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.347209+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"RxcviMP5EGYzSVUD","duration":209} -{"time":"2025-02-19T08:24:51.347229+09:00","level":"DEBUG","msg":"Conn.Close","conn_id":"RxcviMP5EGYzSVUD"} -{"time":"2025-02-19T08:24:51.34732+09:00","level":"INFO","msg":"Conn.Close","conn_id":"RxcviMP5EGYzSVUD","duration":74625} +{"time":"2025-08-06T23:24:04.554997+09:00","level":"TRACE","msg":"Open","driver":"postgres","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} +{"time":"2025-08-06T23:24:04.555138+09:00","level":"INFO","msg":"Open","driver":"postgres","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":12916} +{"time":"2025-08-06T23:24:04.555143+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:04.555151+09:00","level":"TRACE","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} +{"time":"2025-08-06T23:24:04.555738+09:00","level":"ERROR","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":579875,"error":"read tcp 127.0.0.1:61648->127.0.0.1:5432: read: connection reset by peer"} +{"time":"2025-08-06T23:24:04.55575+09:00","level":"ERROR","msg":"Connector.Connect","duration":603208,"error":"read tcp 127.0.0.1:61648->127.0.0.1:5432: read: connection reset by peer"} +{"time":"2025-08-06T23:24:06.556979+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:24:06.55746+09:00","level":"TRACE","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable"} +{"time":"2025-08-06T23:24:06.577368+09:00","level":"INFO","msg":"Driver.Open","dsn":"host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable","duration":19805625,"conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.577485+09:00","level":"INFO","msg":"Connector.Connect","duration":20099625} +{"time":"2025-08-06T23:24:06.577564+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.578624+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"b1n_lbHcZoZNvvGM","duration":1006917} +{"time":"2025-08-06T23:24:06.578728+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.578778+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM","duration":1417} +{"time":"2025-08-06T23:24:06.578824+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"b1n_lbHcZoZNvvGM","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]"} +{"time":"2025-08-06T23:24:06.586314+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"b1n_lbHcZoZNvvGM","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":7430708} +{"time":"2025-08-06T23:24:06.586417+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.586452+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM","duration":1000} +{"time":"2025-08-06T23:24:06.586476+09:00","level":"VERBOSE","msg":"Conn.Ping","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.587181+09:00","level":"TRACE","msg":"Conn.Ping","conn_id":"b1n_lbHcZoZNvvGM","duration":678208} +{"time":"2025-08-06T23:24:06.587244+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.587271+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM","duration":500} +{"time":"2025-08-06T23:24:06.587295+09:00","level":"TRACE","msg":"Conn.BeginTx","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.587763+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"b1n_lbHcZoZNvvGM","duration":452750,"tx_id":"dtuWOqXSssYXMdST"} +{"time":"2025-08-06T23:24:06.58783+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"b1n_lbHcZoZNvvGM","query":"INSERT INTO test1 (id, name) VALUES ($1,$2);","args":"[1,\"Alice\"]"} +{"time":"2025-08-06T23:24:06.589123+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"b1n_lbHcZoZNvvGM","query":"INSERT INTO test1 (id, name) VALUES ($1,$2);","args":"[1,\"Alice\"]","duration":1276375} +{"time":"2025-08-06T23:24:06.589214+09:00","level":"TRACE","msg":"Tx.Commit","conn_id":"b1n_lbHcZoZNvvGM","tx_id":"dtuWOqXSssYXMdST"} +{"time":"2025-08-06T23:24:06.58994+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"b1n_lbHcZoZNvvGM","tx_id":"dtuWOqXSssYXMdST","duration":674417} +{"time":"2025-08-06T23:24:06.589965+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.589976+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"b1n_lbHcZoZNvvGM","duration":334} +{"time":"2025-08-06T23:24:06.589992+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"b1n_lbHcZoZNvvGM","query":"SELECT * FROM test1","args":"[]"} +{"time":"2025-08-06T23:24:06.590399+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"b1n_lbHcZoZNvvGM","query":"SELECT * FROM test1","args":"[]","duration":398375} +{"time":"2025-08-06T23:24:06.590422+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.590449+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"b1n_lbHcZoZNvvGM","duration":3083,"eof":false} +{"time":"2025-08-06T23:24:06.590481+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} +{"time":"2025-08-06T23:24:06.5905+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.590509+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"b1n_lbHcZoZNvvGM","duration":1292,"eof":true} +{"time":"2025-08-06T23:24:06.590518+09:00","level":"VERBOSE","msg":"Rows.Close","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.590525+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"b1n_lbHcZoZNvvGM","duration":334} +{"time":"2025-08-06T23:24:06.590539+09:00","level":"TRACE","msg":"Conn.Close","conn_id":"b1n_lbHcZoZNvvGM"} +{"time":"2025-08-06T23:24:06.590575+09:00","level":"INFO","msg":"Conn.Close","conn_id":"b1n_lbHcZoZNvvGM","duration":30167} diff --git a/examples/logs-postgres/results/verbose-log.txt b/examples/logs-postgres/results/verbose-log.txt index 01d0aad..10cb3f1 100644 --- a/examples/logs-postgres/results/verbose-log.txt +++ b/examples/logs-postgres/results/verbose-log.txt @@ -1,41 +1,41 @@ -time=2025-02-19T08:24:46.479+09:00 level=DEBUG msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:46.479+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=67250 -time=2025-02-19T08:24:46.479+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:46.479+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:46.480+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=1015500 error=EOF -time=2025-02-19T08:24:46.480+09:00 level=ERROR msg=Connector.Connect duration=1076958 error=EOF -time=2025-02-19T08:24:48.481+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:48.482+09:00 level=DEBUG msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" -time=2025-02-19T08:24:48.495+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=13364584 conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.495+09:00 level=INFO msg=Connector.Connect duration=13645166 -time=2025-02-19T08:24:48.495+09:00 level=VERBOSE msg=Conn.Ping conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.496+09:00 level=TRACE msg=Conn.Ping conn_id=8Y6397a_miS2KVZ8 duration=741083 -time=2025-02-19T08:24:48.496+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.496+09:00 level=TRACE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 duration=959 -time=2025-02-19T08:24:48.496+09:00 level=DEBUG msg=Conn.ExecContext conn_id=8Y6397a_miS2KVZ8 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:48.500+09:00 level=INFO msg=Conn.ExecContext conn_id=8Y6397a_miS2KVZ8 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4228208 -time=2025-02-19T08:24:48.501+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.501+09:00 level=TRACE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 duration=459 -time=2025-02-19T08:24:48.501+09:00 level=VERBOSE msg=Conn.Ping conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.501+09:00 level=TRACE msg=Conn.Ping conn_id=8Y6397a_miS2KVZ8 duration=686792 -time=2025-02-19T08:24:48.501+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.501+09:00 level=TRACE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 duration=500 -time=2025-02-19T08:24:48.501+09:00 level=DEBUG msg=Conn.BeginTx conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.502+09:00 level=INFO msg=Conn.BeginTx conn_id=8Y6397a_miS2KVZ8 duration=603250 tx_id=m7rRA81L0yMj7oAg -time=2025-02-19T08:24:48.502+09:00 level=DEBUG msg=Conn.ExecContext conn_id=8Y6397a_miS2KVZ8 query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" -time=2025-02-19T08:24:48.504+09:00 level=INFO msg=Conn.ExecContext conn_id=8Y6397a_miS2KVZ8 query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[{Name: Ordinal:1 Value:1} {Name: Ordinal:2 Value:Alice}]" duration=1624125 -time=2025-02-19T08:24:48.504+09:00 level=DEBUG msg=Tx.Commit conn_id=8Y6397a_miS2KVZ8 tx_id=m7rRA81L0yMj7oAg -time=2025-02-19T08:24:48.505+09:00 level=INFO msg=Tx.Commit conn_id=8Y6397a_miS2KVZ8 tx_id=m7rRA81L0yMj7oAg duration=1068542 -time=2025-02-19T08:24:48.505+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.505+09:00 level=TRACE msg=Conn.ResetSession conn_id=8Y6397a_miS2KVZ8 duration=166 -time=2025-02-19T08:24:48.505+09:00 level=TRACE msg=Conn.QueryContext conn_id=8Y6397a_miS2KVZ8 query="SELECT * FROM test1" args=[] -time=2025-02-19T08:24:48.506+09:00 level=DEBUG msg=Conn.QueryContext conn_id=8Y6397a_miS2KVZ8 query="SELECT * FROM test1" args=[] duration=711459 -time=2025-02-19T08:24:48.506+09:00 level=TRACE msg=Rows.Next conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.506+09:00 level=DEBUG msg=Rows.Next conn_id=8Y6397a_miS2KVZ8 duration=3625 eof=false -time=2025-02-19T08:24:48.506+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:48.506+09:00 level=TRACE msg=Rows.Next conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.506+09:00 level=DEBUG msg=Rows.Next conn_id=8Y6397a_miS2KVZ8 duration=1417 eof=true -time=2025-02-19T08:24:48.506+09:00 level=TRACE msg=Rows.Close conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.506+09:00 level=DEBUG msg=Rows.Close conn_id=8Y6397a_miS2KVZ8 duration=417 -time=2025-02-19T08:24:48.506+09:00 level=DEBUG msg=Conn.Close conn_id=8Y6397a_miS2KVZ8 -time=2025-02-19T08:24:48.506+09:00 level=INFO msg=Conn.Close conn_id=8Y6397a_miS2KVZ8 duration=75583 +time=2025-08-06T23:24:01.733+09:00 level=TRACE msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:24:01.734+09:00 level=INFO msg=Open driver=postgres dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=24667 +time=2025-08-06T23:24:01.734+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:01.734+09:00 level=TRACE msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:24:01.734+09:00 level=ERROR msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=755542 error="read tcp 127.0.0.1:61643->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:24:01.734+09:00 level=ERROR msg=Connector.Connect duration=787042 error="read tcp 127.0.0.1:61643->127.0.0.1:5432: read: connection reset by peer" +time=2025-08-06T23:24:03.736+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:24:03.736+09:00 level=TRACE msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" +time=2025-08-06T23:24:03.752+09:00 level=INFO msg=Driver.Open dsn="host=127.0.0.1 port=5432 user=root password=password dbname=app1 sslmode=disable" duration=15959208 conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.752+09:00 level=INFO msg=Connector.Connect duration=16194208 +time=2025-08-06T23:24:03.752+09:00 level=VERBOSE msg=Conn.Ping conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.753+09:00 level=TRACE msg=Conn.Ping conn_id=giWcNRXi0haxjgDO duration=839084 +time=2025-08-06T23:24:03.753+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.753+09:00 level=TRACE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO duration=1458 +time=2025-08-06T23:24:03.753+09:00 level=TRACE msg=Conn.ExecContext conn_id=giWcNRXi0haxjgDO query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:24:03.758+09:00 level=INFO msg=Conn.ExecContext conn_id=giWcNRXi0haxjgDO query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=4599667 +time=2025-08-06T23:24:03.758+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.758+09:00 level=TRACE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO duration=667 +time=2025-08-06T23:24:03.758+09:00 level=VERBOSE msg=Conn.Ping conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.759+09:00 level=TRACE msg=Conn.Ping conn_id=giWcNRXi0haxjgDO duration=958542 +time=2025-08-06T23:24:03.759+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.759+09:00 level=TRACE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO duration=334 +time=2025-08-06T23:24:03.759+09:00 level=TRACE msg=Conn.BeginTx conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.760+09:00 level=INFO msg=Conn.BeginTx conn_id=giWcNRXi0haxjgDO duration=493125 tx_id=_0Hz9N_J4DB8AcoZ +time=2025-08-06T23:24:03.760+09:00 level=TRACE msg=Conn.ExecContext conn_id=giWcNRXi0haxjgDO query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" +time=2025-08-06T23:24:03.761+09:00 level=INFO msg=Conn.ExecContext conn_id=giWcNRXi0haxjgDO query="INSERT INTO test1 (id, name) VALUES ($1,$2);" args="[1,\"Alice\"]" duration=1293791 +time=2025-08-06T23:24:03.761+09:00 level=TRACE msg=Tx.Commit conn_id=giWcNRXi0haxjgDO tx_id=_0Hz9N_J4DB8AcoZ +time=2025-08-06T23:24:03.762+09:00 level=INFO msg=Tx.Commit conn_id=giWcNRXi0haxjgDO tx_id=_0Hz9N_J4DB8AcoZ duration=1052833 +time=2025-08-06T23:24:03.762+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.762+09:00 level=TRACE msg=Conn.ResetSession conn_id=giWcNRXi0haxjgDO duration=375 +time=2025-08-06T23:24:03.762+09:00 level=TRACE msg=Conn.QueryContext conn_id=giWcNRXi0haxjgDO query="SELECT * FROM test1" args=[] +time=2025-08-06T23:24:03.763+09:00 level=DEBUG msg=Conn.QueryContext conn_id=giWcNRXi0haxjgDO query="SELECT * FROM test1" args=[] duration=645417 +time=2025-08-06T23:24:03.763+09:00 level=VERBOSE msg=Rows.Next conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.763+09:00 level=DEBUG msg=Rows.Next conn_id=giWcNRXi0haxjgDO duration=2625 eof=false +time=2025-08-06T23:24:03.763+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:24:03.763+09:00 level=VERBOSE msg=Rows.Next conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.763+09:00 level=DEBUG msg=Rows.Next conn_id=giWcNRXi0haxjgDO duration=1584 eof=true +time=2025-08-06T23:24:03.763+09:00 level=VERBOSE msg=Rows.Close conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.763+09:00 level=DEBUG msg=Rows.Close conn_id=giWcNRXi0haxjgDO duration=292 +time=2025-08-06T23:24:03.763+09:00 level=TRACE msg=Conn.Close conn_id=giWcNRXi0haxjgDO +time=2025-08-06T23:24:03.763+09:00 level=INFO msg=Conn.Close conn_id=giWcNRXi0haxjgDO duration=70833 diff --git a/examples/logs-sqlite3/results/debug-log.txt b/examples/logs-sqlite3/results/debug-log.txt index a8423c5..504b85b 100644 --- a/examples/logs-sqlite3/results/debug-log.txt +++ b/examples/logs-sqlite3/results/debug-log.txt @@ -1,21 +1,13 @@ -time=2025-02-19T08:24:36.126+09:00 level=DEBUG msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.126+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=39584 -time=2025-02-19T08:24:36.126+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:36.126+09:00 level=DEBUG msg=Driver.Open dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=663833 conn_id=v87XIbB1VCtfz8ug -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Connector.Connect duration=678334 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Conn.ExecContext conn_id=v87XIbB1VCtfz8ug query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Conn.ExecContext conn_id=v87XIbB1VCtfz8ug query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=82166 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Conn.BeginTx conn_id=v87XIbB1VCtfz8ug -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Conn.BeginTx conn_id=v87XIbB1VCtfz8ug duration=3416 tx_id=_VTpZnAgatTSPBfT -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Conn.ExecContext conn_id=v87XIbB1VCtfz8ug query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Conn.ExecContext conn_id=v87XIbB1VCtfz8ug query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" duration=8750 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Tx.Commit conn_id=v87XIbB1VCtfz8ug tx_id=_VTpZnAgatTSPBfT -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Tx.Commit conn_id=v87XIbB1VCtfz8ug tx_id=_VTpZnAgatTSPBfT duration=3583 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Conn.QueryContext conn_id=v87XIbB1VCtfz8ug query="SELECT * FROM test1" args=[] duration=5333 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Rows.Next conn_id=v87XIbB1VCtfz8ug duration=3083 eof=false -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Rows.Next conn_id=v87XIbB1VCtfz8ug duration=1084 eof=true -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Rows.Close conn_id=v87XIbB1VCtfz8ug duration=667 -time=2025-02-19T08:24:36.127+09:00 level=DEBUG msg=Conn.Close conn_id=v87XIbB1VCtfz8ug -time=2025-02-19T08:24:36.127+09:00 level=INFO msg=Conn.Close conn_id=v87XIbB1VCtfz8ug duration=13083 +time=2025-08-06T23:23:51.824+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=45709 +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=546334 conn_id=BmDho0jLHtC3vspy +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Connector.Connect duration=557875 +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Conn.ExecContext conn_id=BmDho0jLHtC3vspy query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=58417 +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Conn.BeginTx conn_id=BmDho0jLHtC3vspy duration=2209 tx_id=UefG6gyYqvfm45nQ +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Conn.ExecContext conn_id=BmDho0jLHtC3vspy query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" duration=7375 +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Tx.Commit conn_id=BmDho0jLHtC3vspy tx_id=UefG6gyYqvfm45nQ duration=3125 +time=2025-08-06T23:23:51.825+09:00 level=DEBUG msg=Conn.QueryContext conn_id=BmDho0jLHtC3vspy query="SELECT * FROM test1" args=[] duration=3958 +time=2025-08-06T23:23:51.825+09:00 level=DEBUG msg=Rows.Next conn_id=BmDho0jLHtC3vspy duration=2292 eof=false +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:51.825+09:00 level=DEBUG msg=Rows.Next conn_id=BmDho0jLHtC3vspy duration=833 eof=true +time=2025-08-06T23:23:51.825+09:00 level=DEBUG msg=Rows.Close conn_id=BmDho0jLHtC3vspy duration=375 +time=2025-08-06T23:23:51.825+09:00 level=INFO msg=Conn.Close conn_id=BmDho0jLHtC3vspy duration=9208 diff --git a/examples/logs-sqlite3/results/info-log.txt b/examples/logs-sqlite3/results/info-log.txt index 36dbcbe..c879b54 100644 --- a/examples/logs-sqlite3/results/info-log.txt +++ b/examples/logs-sqlite3/results/info-log.txt @@ -1,9 +1,9 @@ -time=2025-02-19T08:24:35.795+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=83541 -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=775542 conn_id=ADzZnA7LF2v5b3mP -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Connector.Connect duration=792917 -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Conn.ExecContext conn_id=ADzZnA7LF2v5b3mP query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=104083 -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Conn.BeginTx conn_id=ADzZnA7LF2v5b3mP duration=4000 tx_id=vLGluRMv1qL1tBJV -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Conn.ExecContext conn_id=ADzZnA7LF2v5b3mP query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" duration=11417 -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Tx.Commit conn_id=ADzZnA7LF2v5b3mP tx_id=vLGluRMv1qL1tBJV duration=4291 -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:35.796+09:00 level=INFO msg=Conn.Close conn_id=ADzZnA7LF2v5b3mP duration=16083 +time=2025-08-06T23:23:51.530+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=121792 +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=967542 conn_id=Zs8L4IcPUoMyNZhn +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Connector.Connect duration=1000917 +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Conn.ExecContext conn_id=Zs8L4IcPUoMyNZhn query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=105041 +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Conn.BeginTx conn_id=Zs8L4IcPUoMyNZhn duration=4750 tx_id=oAevp73_l_CDxden +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Conn.ExecContext conn_id=Zs8L4IcPUoMyNZhn query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" duration=11667 +time=2025-08-06T23:23:51.531+09:00 level=INFO msg=Tx.Commit conn_id=Zs8L4IcPUoMyNZhn tx_id=oAevp73_l_CDxden duration=5833 +time=2025-08-06T23:23:51.532+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:51.532+09:00 level=INFO msg=Conn.Close conn_id=Zs8L4IcPUoMyNZhn duration=19084 diff --git a/examples/logs-sqlite3/results/trace-log.txt b/examples/logs-sqlite3/results/trace-log.txt index 21284fd..1af210f 100644 --- a/examples/logs-sqlite3/results/trace-log.txt +++ b/examples/logs-sqlite3/results/trace-log.txt @@ -1,27 +1,24 @@ -time=2025-02-19T08:24:36.449+09:00 level=DEBUG msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.449+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=44000 -time=2025-02-19T08:24:36.449+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:36.449+09:00 level=DEBUG msg=Driver.Open dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=824000 conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Connector.Connect duration=842500 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Conn.ExecContext conn_id=Z2Xdab0y_7Oxsh_6 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Conn.ExecContext conn_id=Z2Xdab0y_7Oxsh_6 query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=100959 -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Conn.ResetSession conn_id=Z2Xdab0y_7Oxsh_6 duration=625 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Conn.BeginTx conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Conn.BeginTx conn_id=Z2Xdab0y_7Oxsh_6 duration=4250 tx_id=6nxdO4jBuf6O_pPX -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Conn.ExecContext conn_id=Z2Xdab0y_7Oxsh_6 query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Conn.ExecContext conn_id=Z2Xdab0y_7Oxsh_6 query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" duration=11959 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Tx.Commit conn_id=Z2Xdab0y_7Oxsh_6 tx_id=6nxdO4jBuf6O_pPX -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Tx.Commit conn_id=Z2Xdab0y_7Oxsh_6 tx_id=6nxdO4jBuf6O_pPX duration=4416 -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Conn.ResetSession conn_id=Z2Xdab0y_7Oxsh_6 duration=41 -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Conn.QueryContext conn_id=Z2Xdab0y_7Oxsh_6 query="SELECT * FROM test1" args=[] -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Conn.QueryContext conn_id=Z2Xdab0y_7Oxsh_6 query="SELECT * FROM test1" args=[] duration=6833 -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Rows.Next conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Rows.Next conn_id=Z2Xdab0y_7Oxsh_6 duration=3625 eof=false -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Rows.Next conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Rows.Next conn_id=Z2Xdab0y_7Oxsh_6 duration=1333 eof=true -time=2025-02-19T08:24:36.450+09:00 level=TRACE msg=Rows.Close conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Rows.Close conn_id=Z2Xdab0y_7Oxsh_6 duration=709 -time=2025-02-19T08:24:36.450+09:00 level=DEBUG msg=Conn.Close conn_id=Z2Xdab0y_7Oxsh_6 -time=2025-02-19T08:24:36.450+09:00 level=INFO msg=Conn.Close conn_id=Z2Xdab0y_7Oxsh_6 duration=16458 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=9916 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Driver.Open dsn="file::memory:?cache=shared" +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=191083 conn_id=jAG1uDtyIgttUGsW +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Connector.Connect duration=202875 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.ExecContext conn_id=jAG1uDtyIgttUGsW query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Conn.ExecContext conn_id=jAG1uDtyIgttUGsW query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=41125 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.ResetSession conn_id=jAG1uDtyIgttUGsW duration=291 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.BeginTx conn_id=jAG1uDtyIgttUGsW +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Conn.BeginTx conn_id=jAG1uDtyIgttUGsW duration=2625 tx_id=OQCmMz6s2uwwxiV0 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.ExecContext conn_id=jAG1uDtyIgttUGsW query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Conn.ExecContext conn_id=jAG1uDtyIgttUGsW query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" duration=8542 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Tx.Commit conn_id=jAG1uDtyIgttUGsW tx_id=OQCmMz6s2uwwxiV0 +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Tx.Commit conn_id=jAG1uDtyIgttUGsW tx_id=OQCmMz6s2uwwxiV0 duration=3125 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.ResetSession conn_id=jAG1uDtyIgttUGsW duration=0 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.QueryContext conn_id=jAG1uDtyIgttUGsW query="SELECT * FROM test1" args=[] +time=2025-08-06T23:23:51.944+09:00 level=DEBUG msg=Conn.QueryContext conn_id=jAG1uDtyIgttUGsW query="SELECT * FROM test1" args=[] duration=4375 +time=2025-08-06T23:23:51.944+09:00 level=DEBUG msg=Rows.Next conn_id=jAG1uDtyIgttUGsW duration=2708 eof=false +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:51.944+09:00 level=DEBUG msg=Rows.Next conn_id=jAG1uDtyIgttUGsW duration=625 eof=true +time=2025-08-06T23:23:51.944+09:00 level=DEBUG msg=Rows.Close conn_id=jAG1uDtyIgttUGsW duration=375 +time=2025-08-06T23:23:51.944+09:00 level=TRACE msg=Conn.Close conn_id=jAG1uDtyIgttUGsW +time=2025-08-06T23:23:51.944+09:00 level=INFO msg=Conn.Close conn_id=jAG1uDtyIgttUGsW duration=9458 diff --git a/examples/logs-sqlite3/results/verbose-log.json b/examples/logs-sqlite3/results/verbose-log.json index 00bbd60..43a824b 100644 --- a/examples/logs-sqlite3/results/verbose-log.json +++ b/examples/logs-sqlite3/results/verbose-log.json @@ -1,29 +1,29 @@ -{"time":"2025-02-19T08:24:37.096351+09:00","level":"DEBUG","msg":"Open","driver":"sqlite3","dsn":"file::memory:?cache=shared"} -{"time":"2025-02-19T08:24:37.096656+09:00","level":"INFO","msg":"Open","driver":"sqlite3","dsn":"file::memory:?cache=shared","duration":47833} -{"time":"2025-02-19T08:24:37.096698+09:00","level":"DEBUG","msg":"Connector.Connect"} -{"time":"2025-02-19T08:24:37.096706+09:00","level":"DEBUG","msg":"Driver.Open","dsn":"file::memory:?cache=shared"} -{"time":"2025-02-19T08:24:37.097456+09:00","level":"INFO","msg":"Driver.Open","dsn":"file::memory:?cache=shared","duration":740708,"conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097465+09:00","level":"INFO","msg":"Connector.Connect","duration":760959} -{"time":"2025-02-19T08:24:37.097474+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"Nx415q3F0RGRnLis","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]"} -{"time":"2025-02-19T08:24:37.097572+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"Nx415q3F0RGRnLis","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":91667} -{"time":"2025-02-19T08:24:37.09758+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097586+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"Nx415q3F0RGRnLis","duration":541} -{"time":"2025-02-19T08:24:37.097591+09:00","level":"DEBUG","msg":"Conn.BeginTx","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097599+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"Nx415q3F0RGRnLis","duration":3541,"tx_id":"3ri_Ws3oiqkQuC81"} -{"time":"2025-02-19T08:24:37.097635+09:00","level":"DEBUG","msg":"Conn.ExecContext","conn_id":"Nx415q3F0RGRnLis","query":"INSERT INTO test1 (name) VALUES (?)","args":"[{Name: Ordinal:1 Value:Alice}]"} -{"time":"2025-02-19T08:24:37.097652+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"Nx415q3F0RGRnLis","query":"INSERT INTO test1 (name) VALUES (?)","args":"[{Name: Ordinal:1 Value:Alice}]","duration":8916} -{"time":"2025-02-19T08:24:37.097671+09:00","level":"DEBUG","msg":"Tx.Commit","conn_id":"Nx415q3F0RGRnLis","tx_id":"3ri_Ws3oiqkQuC81"} -{"time":"2025-02-19T08:24:37.09768+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"Nx415q3F0RGRnLis","tx_id":"3ri_Ws3oiqkQuC81","duration":3834} -{"time":"2025-02-19T08:24:37.097685+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.09769+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"Nx415q3F0RGRnLis","duration":83} -{"time":"2025-02-19T08:24:37.097696+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"Nx415q3F0RGRnLis","query":"SELECT * FROM test1","args":"[]"} -{"time":"2025-02-19T08:24:37.097706+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"Nx415q3F0RGRnLis","query":"SELECT * FROM test1","args":"[]","duration":5708} -{"time":"2025-02-19T08:24:37.097713+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097722+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"Nx415q3F0RGRnLis","duration":3375,"eof":false} -{"time":"2025-02-19T08:24:37.09774+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} -{"time":"2025-02-19T08:24:37.097745+09:00","level":"TRACE","msg":"Rows.Next","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097752+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"Nx415q3F0RGRnLis","duration":1167,"eof":true} -{"time":"2025-02-19T08:24:37.097757+09:00","level":"TRACE","msg":"Rows.Close","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097762+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"Nx415q3F0RGRnLis","duration":708} -{"time":"2025-02-19T08:24:37.097768+09:00","level":"DEBUG","msg":"Conn.Close","conn_id":"Nx415q3F0RGRnLis"} -{"time":"2025-02-19T08:24:37.097787+09:00","level":"INFO","msg":"Conn.Close","conn_id":"Nx415q3F0RGRnLis","duration":14250} +{"time":"2025-08-06T23:23:52.116283+09:00","level":"TRACE","msg":"Open","driver":"sqlite3","dsn":"file::memory:?cache=shared"} +{"time":"2025-08-06T23:23:52.116387+09:00","level":"INFO","msg":"Open","driver":"sqlite3","dsn":"file::memory:?cache=shared","duration":9500} +{"time":"2025-08-06T23:23:52.116395+09:00","level":"TRACE","msg":"Connector.Connect"} +{"time":"2025-08-06T23:23:52.116399+09:00","level":"TRACE","msg":"Driver.Open","dsn":"file::memory:?cache=shared"} +{"time":"2025-08-06T23:23:52.116534+09:00","level":"INFO","msg":"Driver.Open","dsn":"file::memory:?cache=shared","duration":130542,"conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116544+09:00","level":"INFO","msg":"Connector.Connect","duration":144625} +{"time":"2025-08-06T23:23:52.11655+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"SJ9moTag3YK8MQLF","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]"} +{"time":"2025-08-06T23:23:52.116595+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"SJ9moTag3YK8MQLF","query":"CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))","args":"[]","duration":40292} +{"time":"2025-08-06T23:23:52.1166+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116603+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"SJ9moTag3YK8MQLF","duration":334} +{"time":"2025-08-06T23:23:52.116606+09:00","level":"TRACE","msg":"Conn.BeginTx","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116614+09:00","level":"INFO","msg":"Conn.BeginTx","conn_id":"SJ9moTag3YK8MQLF","duration":5625,"tx_id":"eDDVDXHsbgT0oPqc"} +{"time":"2025-08-06T23:23:52.116624+09:00","level":"TRACE","msg":"Conn.ExecContext","conn_id":"SJ9moTag3YK8MQLF","query":"INSERT INTO test1 (name) VALUES (?)","args":"[\"Alice\"]"} +{"time":"2025-08-06T23:23:52.116639+09:00","level":"INFO","msg":"Conn.ExecContext","conn_id":"SJ9moTag3YK8MQLF","query":"INSERT INTO test1 (name) VALUES (?)","args":"[\"Alice\"]","duration":8958} +{"time":"2025-08-06T23:23:52.116646+09:00","level":"TRACE","msg":"Tx.Commit","conn_id":"SJ9moTag3YK8MQLF","tx_id":"eDDVDXHsbgT0oPqc"} +{"time":"2025-08-06T23:23:52.116651+09:00","level":"INFO","msg":"Tx.Commit","conn_id":"SJ9moTag3YK8MQLF","tx_id":"eDDVDXHsbgT0oPqc","duration":3167} +{"time":"2025-08-06T23:23:52.116655+09:00","level":"VERBOSE","msg":"Conn.ResetSession","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116657+09:00","level":"TRACE","msg":"Conn.ResetSession","conn_id":"SJ9moTag3YK8MQLF","duration":0} +{"time":"2025-08-06T23:23:52.11666+09:00","level":"TRACE","msg":"Conn.QueryContext","conn_id":"SJ9moTag3YK8MQLF","query":"SELECT * FROM test1","args":"[]"} +{"time":"2025-08-06T23:23:52.116667+09:00","level":"DEBUG","msg":"Conn.QueryContext","conn_id":"SJ9moTag3YK8MQLF","query":"SELECT * FROM test1","args":"[]","duration":4292} +{"time":"2025-08-06T23:23:52.116672+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116678+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"SJ9moTag3YK8MQLF","duration":2833,"eof":false} +{"time":"2025-08-06T23:23:52.116686+09:00","level":"INFO","msg":"Record","id":1,"name":"Alice"} +{"time":"2025-08-06T23:23:52.116688+09:00","level":"VERBOSE","msg":"Rows.Next","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116692+09:00","level":"DEBUG","msg":"Rows.Next","conn_id":"SJ9moTag3YK8MQLF","duration":916,"eof":true} +{"time":"2025-08-06T23:23:52.116695+09:00","level":"VERBOSE","msg":"Rows.Close","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116698+09:00","level":"DEBUG","msg":"Rows.Close","conn_id":"SJ9moTag3YK8MQLF","duration":458} +{"time":"2025-08-06T23:23:52.116702+09:00","level":"TRACE","msg":"Conn.Close","conn_id":"SJ9moTag3YK8MQLF"} +{"time":"2025-08-06T23:23:52.116715+09:00","level":"INFO","msg":"Conn.Close","conn_id":"SJ9moTag3YK8MQLF","duration":10333} diff --git a/examples/logs-sqlite3/results/verbose-log.txt b/examples/logs-sqlite3/results/verbose-log.txt index 0e90b01..1caf2ad 100644 --- a/examples/logs-sqlite3/results/verbose-log.txt +++ b/examples/logs-sqlite3/results/verbose-log.txt @@ -1,29 +1,29 @@ -time=2025-02-19T08:24:36.778+09:00 level=DEBUG msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.778+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=48834 -time=2025-02-19T08:24:36.778+09:00 level=DEBUG msg=Connector.Connect -time=2025-02-19T08:24:36.778+09:00 level=DEBUG msg=Driver.Open dsn="file::memory:?cache=shared" -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=812541 conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Connector.Connect duration=830875 -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Conn.ExecContext conn_id=DHIaKg4dGsNaJKno query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Conn.ExecContext conn_id=DHIaKg4dGsNaJKno query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=103542 -time=2025-02-19T08:24:36.779+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Conn.ResetSession conn_id=DHIaKg4dGsNaJKno duration=708 -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Conn.BeginTx conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Conn.BeginTx conn_id=DHIaKg4dGsNaJKno duration=4166 tx_id=p3TnEFe42_hv1aFr -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Conn.ExecContext conn_id=DHIaKg4dGsNaJKno query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Conn.ExecContext conn_id=DHIaKg4dGsNaJKno query="INSERT INTO test1 (name) VALUES (?)" args="[{Name: Ordinal:1 Value:Alice}]" duration=9750 -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Tx.Commit conn_id=DHIaKg4dGsNaJKno tx_id=p3TnEFe42_hv1aFr -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Tx.Commit conn_id=DHIaKg4dGsNaJKno tx_id=p3TnEFe42_hv1aFr duration=4375 -time=2025-02-19T08:24:36.779+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Conn.ResetSession conn_id=DHIaKg4dGsNaJKno duration=125 -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Conn.QueryContext conn_id=DHIaKg4dGsNaJKno query="SELECT * FROM test1" args=[] -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Conn.QueryContext conn_id=DHIaKg4dGsNaJKno query="SELECT * FROM test1" args=[] duration=6583 -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Rows.Next conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Rows.Next conn_id=DHIaKg4dGsNaJKno duration=3667 eof=false -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Record id=1 name=Alice -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Rows.Next conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Rows.Next conn_id=DHIaKg4dGsNaJKno duration=1375 eof=true -time=2025-02-19T08:24:36.779+09:00 level=TRACE msg=Rows.Close conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Rows.Close conn_id=DHIaKg4dGsNaJKno duration=833 -time=2025-02-19T08:24:36.779+09:00 level=DEBUG msg=Conn.Close conn_id=DHIaKg4dGsNaJKno -time=2025-02-19T08:24:36.779+09:00 level=INFO msg=Conn.Close conn_id=DHIaKg4dGsNaJKno duration=15958 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Open driver=sqlite3 dsn="file::memory:?cache=shared" duration=7334 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Connector.Connect +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Driver.Open dsn="file::memory:?cache=shared" +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Driver.Open dsn="file::memory:?cache=shared" duration=132458 conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Connector.Connect duration=145083 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.ExecContext conn_id=h_puYkHhQqD5H2eY query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Conn.ExecContext conn_id=h_puYkHhQqD5H2eY query="CREATE TABLE IF NOT EXISTS test1 (id INTEGER PRIMARY KEY, name VARCHAR(255))" args=[] duration=45750 +time=2025-08-06T23:23:52.030+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.ResetSession conn_id=h_puYkHhQqD5H2eY duration=375 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.BeginTx conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Conn.BeginTx conn_id=h_puYkHhQqD5H2eY duration=2583 tx_id=CmO0XjmAvjYSuYLy +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.ExecContext conn_id=h_puYkHhQqD5H2eY query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Conn.ExecContext conn_id=h_puYkHhQqD5H2eY query="INSERT INTO test1 (name) VALUES (?)" args="[\"Alice\"]" duration=7459 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Tx.Commit conn_id=h_puYkHhQqD5H2eY tx_id=CmO0XjmAvjYSuYLy +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Tx.Commit conn_id=h_puYkHhQqD5H2eY tx_id=CmO0XjmAvjYSuYLy duration=2709 +time=2025-08-06T23:23:52.030+09:00 level=VERBOSE msg=Conn.ResetSession conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.ResetSession conn_id=h_puYkHhQqD5H2eY duration=42 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.QueryContext conn_id=h_puYkHhQqD5H2eY query="SELECT * FROM test1" args=[] +time=2025-08-06T23:23:52.030+09:00 level=DEBUG msg=Conn.QueryContext conn_id=h_puYkHhQqD5H2eY query="SELECT * FROM test1" args=[] duration=4084 +time=2025-08-06T23:23:52.030+09:00 level=VERBOSE msg=Rows.Next conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=DEBUG msg=Rows.Next conn_id=h_puYkHhQqD5H2eY duration=2583 eof=false +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Record id=1 name=Alice +time=2025-08-06T23:23:52.030+09:00 level=VERBOSE msg=Rows.Next conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=DEBUG msg=Rows.Next conn_id=h_puYkHhQqD5H2eY duration=750 eof=true +time=2025-08-06T23:23:52.030+09:00 level=VERBOSE msg=Rows.Close conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=DEBUG msg=Rows.Close conn_id=h_puYkHhQqD5H2eY duration=375 +time=2025-08-06T23:23:52.030+09:00 level=TRACE msg=Conn.Close conn_id=h_puYkHhQqD5H2eY +time=2025-08-06T23:23:52.030+09:00 level=INFO msg=Conn.Close conn_id=h_puYkHhQqD5H2eY duration=9416 diff --git a/step_options.go b/step_options.go index 4aa3579..856d1bd 100644 --- a/step_options.go +++ b/step_options.go @@ -57,11 +57,11 @@ func defaultStepOptions(msgb StepEventMsgBuilder, step Step, completeLevel Level var startLevel Level switch completeLevel { // nolint:exhaustive case LevelError: - startLevel = LevelInfo - case LevelInfo: startLevel = LevelDebug - case LevelDebug: + case LevelInfo: startLevel = LevelTrace + case LevelDebug: + startLevel = LevelVerbose default: startLevel = LevelVerbose } diff --git a/step_options_test.go b/step_options_test.go index ae95ef1..a1591bb 100644 --- a/step_options_test.go +++ b/step_options_test.go @@ -69,8 +69,8 @@ func TestDefaultStepOptions(t *testing.T) { t.Run("LevelError", func(t *testing.T) { t.Parallel() o := defaultStepOptions(StepEventMsgWithoutEventName, Step("test"), LevelError) - if o.Start.Level != LevelInfo { - t.Errorf("Expected %v, but got %v", LevelInfo, o.Start.Level) + if o.Start.Level != LevelDebug { + t.Errorf("Expected %v, but got %v", LevelDebug, o.Start.Level) } if o.Complete.Level != LevelError { t.Errorf("Expected %v, but got %v", LevelError, o.Complete.Level) diff --git a/stmt.go b/stmt.go index 2a0eb14..86718e8 100644 --- a/stmt.go +++ b/stmt.go @@ -3,7 +3,6 @@ package sqlslog import ( "context" "database/sql/driver" - "fmt" "log/slog" ) @@ -19,11 +18,11 @@ type stmtOptions struct { func defaultStmtOptions(msgb StepEventMsgBuilder) *stmtOptions { return &stmtOptions{ - Close: *defaultStepOptions(msgb, StepStmtClose, LevelInfo), - Exec: *defaultStepOptions(msgb, StepStmtExec, LevelInfo), - Query: *defaultStepOptions(msgb, StepStmtQuery, LevelInfo), - ExecContext: *defaultStepOptions(msgb, StepStmtExecContext, LevelInfo), - QueryContext: *defaultStepOptions(msgb, StepStmtQueryContext, LevelInfo), + Close: *defaultStepOptions(msgb, StepStmtClose, LevelDebug), + Exec: *defaultStepOptions(msgb, StepStmtExec, LevelDebug), + Query: *defaultStepOptions(msgb, StepStmtQuery, LevelDebug), + ExecContext: *defaultStepOptions(msgb, StepStmtExecContext, LevelDebug), + QueryContext: *defaultStepOptions(msgb, StepStmtQueryContext, LevelDebug), Rows: defaultRowsOptions(msgb), } } @@ -88,7 +87,7 @@ func (s *stmtWrapper) Close() error { // Exec implements driver.Stmt. func (s *stmtWrapper) Exec(args []driver.Value) (driver.Result, error) { - lg := s.logger.With(slog.String("args", fmt.Sprintf("%+v", args))) + lg := s.logger.With(slog.String("args", formatValues(args))) var result driver.Result err := ignoreAttr(lg.StepWithoutContext(&s.options.Exec, func() (*slog.Attr, error) { var err error @@ -108,7 +107,7 @@ func (s *stmtWrapper) NumInput() int { // Query implements driver.Stmt. func (s *stmtWrapper) Query(args []driver.Value) (driver.Rows, error) { - lg := s.logger.With(slog.String("args", fmt.Sprintf("%+v", args))) + lg := s.logger.With(slog.String("args", formatValues(args))) var rows driver.Rows err := ignoreAttr(lg.StepWithoutContext(&s.options.Query, func() (*slog.Attr, error) { var err error @@ -131,7 +130,7 @@ var _ driver.StmtExecContext = (*stmtExecContextWrapperImpl)(nil) // ExecContext implements driver.StmtExecContext. func (s *stmtExecContextWrapperImpl) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { - lg := s.logger.With(slog.String("args", fmt.Sprintf("%+v", args))) + lg := s.logger.With(slog.String("args", formatNamedValues(args))) var result driver.Result err := ignoreAttr(lg.Step(ctx, &s.options.ExecContext, func() (*slog.Attr, error) { var err error @@ -154,7 +153,7 @@ var _ driver.StmtQueryContext = (*stmtQueryContextWrapperImpl)(nil) // QueryContext implements driver.StmtQueryContext. func (s *stmtQueryContextWrapperImpl) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { - lg := s.logger.With(slog.String("args", fmt.Sprintf("%+v", args))) + lg := s.logger.With(slog.String("args", formatNamedValues(args))) var rows driver.Rows err := ignoreAttr(lg.Step(ctx, &s.options.QueryContext, func() (*slog.Attr, error) { var err error diff --git a/stmt_args.go b/stmt_args.go new file mode 100644 index 0000000..29ff2ec --- /dev/null +++ b/stmt_args.go @@ -0,0 +1,96 @@ +package sqlslog + +import ( + "database/sql/driver" + "fmt" + "slices" + "strings" +) + +func cmpNamedValueByOrdinal(a, b driver.NamedValue) int { + return a.Ordinal - b.Ordinal +} + +func formatNamedValues(args []driver.NamedValue) string { + if len(args) == 0 { + return "[]" + } + if !slices.ContainsFunc(args, func(arg driver.NamedValue) bool { return arg.Name == "" }) { + return formatNamedValuesWithNames(args) + } + if !slices.ContainsFunc(args, func(arg driver.NamedValue) bool { return arg.Name != "" }) { + return formatNamedValuesWithoutNames(args) + } + return formatNamedValuesWithMixedNames(args) +} + +func formatNamedValuesWithNames(args []driver.NamedValue) string { + var b strings.Builder + b.WriteString("{") + for i, arg := range args { + if i > 0 { + b.WriteString(",") + } + fmt.Fprintf(&b, "%s:", arg.Name) + b.WriteString(formatValue(arg.Value)) + } + b.WriteString("}") + return b.String() +} + +func formatNamedValuesWithoutNames(args []driver.NamedValue) string { + if !slices.IsSortedFunc(args, cmpNamedValueByOrdinal) { + slices.SortFunc(args, cmpNamedValueByOrdinal) + } + var b strings.Builder + b.WriteString("[") + for i, arg := range args { + if i > 0 { + b.WriteString(",") + } + b.WriteString(formatValue(arg.Value)) + } + b.WriteString("]") + return b.String() +} + +func formatNamedValuesWithMixedNames(args []driver.NamedValue) string { + var b strings.Builder + b.WriteString("[") + for i, arg := range args { + if i > 0 { + b.WriteString(",") + } + fmt.Fprintf(&b, "[%d]%s:", arg.Ordinal, arg.Name) + b.WriteString(formatValue(arg.Value)) + } + b.WriteString("]") + return b.String() +} + +func formatValues(values []driver.Value) string { + if len(values) == 0 { + return "[]" + } + var b strings.Builder + b.WriteString("[") + for i, value := range values { + if i > 0 { + b.WriteString(",") + } + b.WriteString(formatValue(value)) + } + b.WriteString("]") + return b.String() +} + +func formatValue(v any) string { + switch v := v.(type) { + case string: + return fmt.Sprintf("%q", v) + case []byte: + return fmt.Sprintf("%q", v) + default: + return fmt.Sprintf("%v", v) + } +} diff --git a/stmt_args_test.go b/stmt_args_test.go new file mode 100644 index 0000000..21de6d1 --- /dev/null +++ b/stmt_args_test.go @@ -0,0 +1,94 @@ +package sqlslog + +import ( + "database/sql/driver" + "testing" + "time" +) + +func TestFormatNamedValues(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + args []driver.NamedValue + want string + }{ + { + name: "empty", + args: nil, + want: "[]", + }, + { + name: "no names without ordinals", + args: []driver.NamedValue{{Value: "A"}, {Value: 2}}, + want: "[\"A\",2]", + }, + { + name: "no names with sorted ordinals", + args: []driver.NamedValue{{Ordinal: 1, Value: "a"}, {Ordinal: 2, Value: 100}, {Ordinal: 3, Value: 1.234}}, + want: "[\"a\",100,1.234]", + }, + { + name: "no names with unsorted ordinals", + args: []driver.NamedValue{{Ordinal: 2, Value: 100}, {Ordinal: 3, Value: 1.234}, {Ordinal: 1, Value: "a"}}, + want: "[\"a\",100,1.234]", + }, + { + name: "no names with invalid ordinals", + args: []driver.NamedValue{{Ordinal: 2, Value: 100}, {Ordinal: 5, Value: 1.234}, {Ordinal: 0, Value: "a"}}, + want: "[\"a\",100,1.234]", + }, + { + name: "all names", + args: []driver.NamedValue{{Name: "a", Value: 1}, {Name: "b", Value: 2}}, + want: "{a:1,b:2}", + }, + { + name: "mixed names", + args: []driver.NamedValue{{Ordinal: 0, Name: "a", Value: 1}, {Ordinal: 1, Name: "", Value: 2}}, + want: "[[0]a:1,[1]:2]", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + got := formatNamedValues(tt.args) + if got != tt.want { + t.Errorf("formatNamedValues() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestFormatValue(t *testing.T) { + t.Parallel() + + tests := []struct { + value driver.Value + want string + }{ + {value: nil, want: ""}, + {value: true, want: "true"}, + {value: false, want: "false"}, + {value: 123, want: "123"}, + {value: 1.23, want: "1.23"}, + {value: "test", want: "\"test\""}, + {value: []byte("bytes"), want: "\"bytes\""}, + {value: []int{1, 2, 3}, want: "[1 2 3]"}, + {value: map[string]int{"a": 1, "b": 2}, want: "map[a:1 b:2]"}, + {value: struct{ A int }{A: 1}, want: "{1}"}, + {value: time.Date(2023, 10, 1, 12, 0, 0, 0, time.UTC), want: "2023-10-01 12:00:00 +0000 UTC"}, + } + + for _, tt := range tests { + t.Run(tt.want, func(t *testing.T) { + t.Parallel() + got := formatValue(tt.value) + if got != tt.want { + t.Errorf("formatValue(%v) = %v, want %v", tt.value, got, tt.want) + } + }) + } +} diff --git a/tests/mysql/low_level_with_context_test.go b/tests/mysql/low_level_with_context_test.go index 99af0d6..966723d 100644 --- a/tests/mysql/low_level_with_context_test.go +++ b/tests/mysql/low_level_with_context_test.go @@ -59,8 +59,8 @@ func TestLowLevelWithContext(t *testing.T) { t.Run("sqlslog.Open log", func(t *testing.T) { logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "sqlslog.Open Start", "driver": "mysql", "dsn": dsn}, - {"level": "DEBUG", "msg": "Driver.OpenConnector Start", "dsn": dsn}, + {"level": "TRACE", "msg": "sqlslog.Open Start", "driver": "mysql", "dsn": dsn}, + {"level": "TRACE", "msg": "Driver.OpenConnector Start", "dsn": dsn}, {"level": "INFO", "msg": "Driver.OpenConnector Complete", "dsn": dsn, connIDKey: connIDExpected}, {"level": "INFO", "msg": "sqlslog.Open Complete", "driver": "mysql", "dsn": dsn}, }) @@ -95,7 +95,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[]", connIDKey: connIDExpected}, }) @@ -116,8 +116,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -126,8 +126,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -139,8 +139,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -150,21 +150,21 @@ func TestLowLevelWithContext(t *testing.T) { t.Run("insert "+name, func(t *testing.T) { stmtIDExpected := seqIdGen.Next() query := "INSERT INTO test1 (id, name) VALUES (?, ?)" - args := fmt.Sprintf("[{Name: Ordinal:1 Value:%d} {Name: Ordinal:2 Value:%s}]", i+1, name) + args := fmt.Sprintf("[%d,%q]", i+1, name) logs.Start() result, err := db.ExecContext(ctx, query, i+1, name) assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, "skip": true, connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": "INSERT INTO test1 (id, name) VALUES (?, ?)", connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": "INSERT INTO test1 (id, name) VALUES (?, ?)", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": "INSERT INTO test1 (id, name) VALUES (?, ?)", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": "INSERT INTO test1 (id, name) VALUES (?, ?)", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -186,16 +186,16 @@ func TestLowLevelWithContext(t *testing.T) { assert.NoError(t, rows.Close()) logs.AssertEmpty(t) // Rows.Close and Stmt.Close are called from rows.Next when EOF }() - args := "[{Name: Ordinal:1 Value:ba%}]" + args := "[\"ba%\"]" logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.QueryContext Complete", "query": query, "args": args, "skip": true, connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": "SELECT id, name FROM test1 WHERE name LIKE ?", connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": "SELECT id, name FROM test1 WHERE name LIKE ?", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.QueryContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.QueryContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": "SELECT id, name FROM test1 WHERE name LIKE ?", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": "SELECT id, name FROM test1 WHERE name LIKE ?", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.QueryContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.QueryContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) t.Run("rows.Columns", func(t *testing.T) { @@ -255,7 +255,7 @@ func TestLowLevelWithContext(t *testing.T) { actualResults := []map[string]interface{}{} for rows.Next() { logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -272,12 +272,12 @@ func TestLowLevelWithContext(t *testing.T) { } logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": true, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) expectedResults := []map[string]interface{}{ @@ -301,16 +301,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -322,11 +322,11 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.QueryContext Start", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.QueryContext Complete", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.QueryContext Start", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.QueryContext Complete", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) assert.Equal(t, test1Record{ID: 1, Name: "foo"}, foo) @@ -342,16 +342,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -362,8 +362,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := result.RowsAffected() assert.NoError(t, err) @@ -381,7 +381,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -390,17 +390,17 @@ func TestLowLevelWithContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" logs.Start() r, err := tx.ExecContext(ctx, query, "qux", 3) - args := "[{Name: Ordinal:1 Value:qux} {Name: Ordinal:2 Value:3}]" + args := "[\"qux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, "skip": true, connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := r.RowsAffected() @@ -412,7 +412,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Rollback() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -425,7 +425,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -434,17 +434,17 @@ func TestLowLevelWithContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" logs.Start() r, err := tx.ExecContext(ctx, query, "quux", 3) - args := "[{Name: Ordinal:1 Value:quux} {Name: Ordinal:2 Value:3}]" + args := "[\"quux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, "skip": true, connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := r.RowsAffected() @@ -456,7 +456,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Commit() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Commit Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) diff --git a/tests/postgres/low_level_with_context_test.go b/tests/postgres/low_level_with_context_test.go index 7f7a06e..1252dfb 100644 --- a/tests/postgres/low_level_with_context_test.go +++ b/tests/postgres/low_level_with_context_test.go @@ -59,7 +59,7 @@ func TestLowLevelWithContext(t *testing.T) { t.Run("sqlslog.Open log", func(t *testing.T) { logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "sqlslog.Open Start", "driver": "postgres", "dsn": dsn}, + {"level": "TRACE", "msg": "sqlslog.Open Start", "driver": "postgres", "dsn": dsn}, {"level": "INFO", "msg": "sqlslog.Open Complete", "driver": "postgres", "dsn": dsn}, }) }) @@ -93,7 +93,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[]", connIDKey: connIDExpected}, }) @@ -113,8 +113,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -123,8 +123,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -136,8 +136,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -152,8 +152,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": fmt.Sprintf("[{Name: Ordinal:1 Value:%d} {Name: Ordinal:2 Value:%s}]", i+1, name), connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": fmt.Sprintf("[{Name: Ordinal:1 Value:%d} {Name: Ordinal:2 Value:%s}]", i+1, name), connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": fmt.Sprintf("[%d,%q]", i+1, name), connIDKey: connIDExpected}, + {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": fmt.Sprintf("[%d,%q]", i+1, name), connIDKey: connIDExpected}, }) logs.Start() @@ -179,8 +179,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.QueryContext Start", "query": query, "args": "[{Name: Ordinal:1 Value:ba%}]", connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.QueryContext Complete", "query": query, "args": "[{Name: Ordinal:1 Value:ba%}]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.QueryContext Start", "query": query, "args": "[\"ba%\"]", connIDKey: connIDExpected}, + {"level": "INFO", "msg": "Conn.QueryContext Complete", "query": query, "args": "[\"ba%\"]", connIDKey: connIDExpected}, }) t.Run("rows.Columns", func(t *testing.T) { @@ -240,7 +240,7 @@ func TestLowLevelWithContext(t *testing.T) { actualResults := []map[string]interface{}{} for rows.Next() { logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected}, }) logs.Start() @@ -257,9 +257,9 @@ func TestLowLevelWithContext(t *testing.T) { } logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": true, connIDKey: connIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected}, }) @@ -284,16 +284,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -305,11 +305,11 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.QueryContext Start", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.QueryContext Complete", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.QueryContext Start", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.QueryContext Complete", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) assert.Equal(t, test1Record{ID: 1, Name: "foo"}, foo) @@ -325,16 +325,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -345,8 +345,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := result.RowsAffected() assert.NoError(t, err) @@ -364,7 +364,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -374,8 +374,8 @@ func TestLowLevelWithContext(t *testing.T) { r, err := tx.ExecContext(ctx, query, "qux", int64(3)) assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[{Name: Ordinal:1 Value:qux} {Name: Ordinal:2 Value:3}]", connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[{Name: Ordinal:1 Value:qux} {Name: Ordinal:2 Value:3}]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[\"qux\",3]", connIDKey: connIDExpected}, + {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[\"qux\",3]", connIDKey: connIDExpected}, }) rowsAffected, err := r.RowsAffected() @@ -387,7 +387,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Rollback() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -400,7 +400,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -410,8 +410,8 @@ func TestLowLevelWithContext(t *testing.T) { r, err := tx.ExecContext(ctx, query, "quux", int64(3)) assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[{Name: Ordinal:1 Value:quux} {Name: Ordinal:2 Value:3}]", connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[{Name: Ordinal:1 Value:quux} {Name: Ordinal:2 Value:3}]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[\"quux\",3]", connIDKey: connIDExpected}, + {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[\"quux\",3]", connIDKey: connIDExpected}, }) rowsAffected, err := r.RowsAffected() @@ -423,7 +423,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Commit() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Commit Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) diff --git a/tests/sqlite3/low_level_with_context_test.go b/tests/sqlite3/low_level_with_context_test.go index 1e3c1de..9f5ace6 100644 --- a/tests/sqlite3/low_level_with_context_test.go +++ b/tests/sqlite3/low_level_with_context_test.go @@ -49,7 +49,7 @@ func TestLowLevelWithContext(t *testing.T) { t.Run("sqlslog.Open log", func(t *testing.T) { logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "sqlslog.Open Start", "driver": "sqlite3", "dsn": dsn}, + {"level": "TRACE", "msg": "sqlslog.Open Start", "driver": "sqlite3", "dsn": dsn}, {"level": "INFO", "msg": "sqlslog.Open Complete", "driver": "sqlite3", "dsn": dsn}, }) }) @@ -83,7 +83,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[]", connIDKey: connIDExpected}, }) @@ -104,8 +104,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -114,8 +114,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) logs.Start() @@ -127,8 +127,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -137,14 +137,14 @@ func TestLowLevelWithContext(t *testing.T) { for i, name := range testData { t.Run("insert "+name, func(t *testing.T) { query := "INSERT INTO test1 (id, name) VALUES (?, ?)" - args := fmt.Sprintf("[{Name: Ordinal:1 Value:%d} {Name: Ordinal:2 Value:%s}]", i+1, name) + args := fmt.Sprintf("[%d,%q]", i+1, name) logs.Start() result, err := db.ExecContext(ctx, query, i+1, name) assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -210,11 +210,11 @@ func TestLowLevelWithContext(t *testing.T) { // {"level": "DEBUG", "msg": "Rows.Close Complete"}, }) }() - args := "[{Name: Ordinal:1 Value:ba%}]" + args := "[\"ba%\"]" logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.QueryContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -275,7 +275,7 @@ func TestLowLevelWithContext(t *testing.T) { actualResults := []map[string]interface{}{} for rows.Next() { logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected}, }) logs.Start() @@ -290,9 +290,9 @@ func TestLowLevelWithContext(t *testing.T) { } logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": true, connIDKey: connIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected}, }) @@ -317,16 +317,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -338,11 +338,11 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.QueryContext Start", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.QueryContext Complete", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.QueryContext Start", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.QueryContext Complete", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) assert.Equal(t, test1Record{ID: 1, Name: "foo"}, foo) @@ -357,7 +357,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, {"level": "ERROR", "msg": "Conn.PrepareContext Error", "query": query, "error": "near \"invalid\": syntax error", connIDKey: connIDExpected}, }) }) @@ -371,16 +371,16 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { logs.Start() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -392,8 +392,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := result.RowsAffected() assert.NoError(t, err) @@ -403,11 +403,11 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() _, err := stmt.ExecContext(ctx, "abc", "qux") assert.Error(t, err) - args := "[{Name: Ordinal:1 Value:abc} {Name: Ordinal:2 Value:qux}]" + args := "[\"abc\",\"qux\"]" logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "ERROR", "msg": "Stmt.ExecContext Error", "args": args, "error": "datatype mismatch", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -424,7 +424,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -432,10 +432,10 @@ func TestLowLevelWithContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" logs.Start() r, err := tx.ExecContext(ctx, query, "qux", int64(3)) - args := "[{Name: Ordinal:1 Value:qux} {Name: Ordinal:2 Value:3}]" + args := "[\"qux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -448,7 +448,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Rollback() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -461,7 +461,7 @@ func TestLowLevelWithContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -469,10 +469,10 @@ func TestLowLevelWithContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" logs.Start() r, err := tx.ExecContext(ctx, query, "quux", int64(3)) - args := "[{Name: Ordinal:1 Value:quux} {Name: Ordinal:2 Value:3}]" + args := "[\"quux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -485,7 +485,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Commit() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Commit Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -524,7 +524,7 @@ func TestLowLevelWithContext(t *testing.T) { tx, err = dConn.Begin() require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.Begin Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.Begin Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.Begin Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -537,7 +537,7 @@ func TestLowLevelWithContext(t *testing.T) { stmt, err := dConn.Prepare(query) require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.Prepare Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) @@ -545,8 +545,8 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -571,10 +571,10 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() result, err := stmt.Exec([]driver.Value{4, "qux"}) assert.NoError(t, err) - args := "[4 qux]" + args := "[4,\"qux\"]" logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Exec Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Exec Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Exec Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Exec Complete", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := result.RowsAffected() assert.NoError(t, err) @@ -584,9 +584,9 @@ func TestLowLevelWithContext(t *testing.T) { logs.Start() _, err := stmt.Exec([]driver.Value{"abc", "qux"}) assert.Error(t, err) - args := "[abc qux]" + args := "[\"abc\",\"qux\"]" logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Exec Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Exec Start", "args": args, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "ERROR", "msg": "Stmt.Exec Error", "args": args, "error": "datatype mismatch", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -598,7 +598,7 @@ func TestLowLevelWithContext(t *testing.T) { err := tx.Rollback() require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) diff --git a/tests/sqlite3/low_level_without_context_test.go b/tests/sqlite3/low_level_without_context_test.go index 2c16231..c3552d1 100644 --- a/tests/sqlite3/low_level_without_context_test.go +++ b/tests/sqlite3/low_level_without_context_test.go @@ -49,7 +49,7 @@ func TestLowLevelWithoutContext(t *testing.T) { t.Run("sqlslog.Open log", func(t *testing.T) { logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "sqlslog.Open Start", "driver": "sqlite3", "dsn": dsn}, + {"level": "TRACE", "msg": "sqlslog.Open Start", "driver": "sqlite3", "dsn": dsn}, {"level": "INFO", "msg": "sqlslog.Open Complete", "driver": "sqlite3", "dsn": dsn}, }) }) @@ -83,7 +83,7 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": "[]", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": "[]", connIDKey: connIDExpected}, }) @@ -104,8 +104,8 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) buf.Reset() @@ -114,8 +114,8 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) buf.Reset() @@ -127,8 +127,8 @@ func TestLowLevelWithoutContext(t *testing.T) { buf.Reset() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }) @@ -137,14 +137,14 @@ func TestLowLevelWithoutContext(t *testing.T) { for i, name := range testData { t.Run("insert "+name, func(t *testing.T) { query := "INSERT INTO test1 (id, name) VALUES (?, ?)" - args := fmt.Sprintf("[{Name: Ordinal:1 Value:%d} {Name: Ordinal:2 Value:%s}]", i+1, name) + args := fmt.Sprintf("[%d,\"%s\"]", i+1, name) buf.Reset() result, err := db.Exec(query, i+1, name) assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -210,11 +210,11 @@ func TestLowLevelWithoutContext(t *testing.T) { // {"level": "DEBUG", "msg": "Rows.Close Complete"}, }) }() - args := "[{Name: Ordinal:1 Value:ba%}]" + args := "[\"ba%\"]" logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.QueryContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.QueryContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -275,7 +275,7 @@ func TestLowLevelWithoutContext(t *testing.T) { actualResults := []map[string]interface{}{} for rows.Next() { logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected}, }) buf.Reset() @@ -290,9 +290,9 @@ func TestLowLevelWithoutContext(t *testing.T) { } logs.Assert(t, []map[string]interface{}{ - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": true, connIDKey: connIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected}, }) @@ -317,16 +317,16 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { buf.Reset() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -338,11 +338,11 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.QueryContext Start", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.QueryContext Complete", "args": "[{Name: Ordinal:1 Value:1}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.QueryContext Start", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.QueryContext Complete", "args": "[1]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Next Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Next Complete", "eof": false, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "TRACE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Rows.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, {"level": "DEBUG", "msg": "Rows.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) assert.Equal(t, test1Record{ID: 1, Name: "foo"}, foo) @@ -359,16 +359,16 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) defer func() { buf.Reset() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -379,8 +379,8 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Stmt.ExecContext Start", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.ExecContext Complete", "args": "[{Name: Ordinal:1 Value:4} {Name: Ordinal:2 Value:qux}]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.ExecContext Start", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.ExecContext Complete", "args": "[4,\"qux\"]", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) rowsAffected, err := result.RowsAffected() assert.NoError(t, err) @@ -398,7 +398,7 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -406,10 +406,10 @@ func TestLowLevelWithoutContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" buf.Reset() r, err := tx.Exec(query, "qux", int64(3)) - args := "[{Name: Ordinal:1 Value:qux} {Name: Ordinal:2 Value:3}]" + args := "[\"qux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -422,7 +422,7 @@ func TestLowLevelWithoutContext(t *testing.T) { err := tx.Rollback() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -435,7 +435,7 @@ func TestLowLevelWithoutContext(t *testing.T) { logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.BeginTx Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.BeginTx Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) @@ -443,10 +443,10 @@ func TestLowLevelWithoutContext(t *testing.T) { query := "UPDATE test1 SET name = ? WHERE id = ?" buf.Reset() r, err := tx.Exec(query, "quux", int64(3)) - args := "[{Name: Ordinal:1 Value:quux} {Name: Ordinal:2 Value:3}]" + args := "[\"quux\",3]" assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.ExecContext Start", "query": query, "args": args, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.ExecContext Complete", "query": query, "args": args, connIDKey: connIDExpected}, }) @@ -459,7 +459,7 @@ func TestLowLevelWithoutContext(t *testing.T) { err := tx.Commit() assert.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Commit Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Commit Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -499,7 +499,7 @@ func TestLowLevelWithoutContext(t *testing.T) { tx, err = dConn.Begin() require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.Begin Start", connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.Begin Start", connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.Begin Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -512,7 +512,7 @@ func TestLowLevelWithoutContext(t *testing.T) { stmt, err := dConn.Prepare(query) require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.Prepare Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) @@ -520,8 +520,8 @@ func TestLowLevelWithoutContext(t *testing.T) { buf.Reset() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -540,7 +540,7 @@ func TestLowLevelWithoutContext(t *testing.T) { stmt, err := dConn.Prepare(query) require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.Prepare Start", "query": query, connIDKey: connIDExpected}, {"level": "INFO", "msg": "Conn.Prepare Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) @@ -548,8 +548,8 @@ func TestLowLevelWithoutContext(t *testing.T) { buf.Reset() stmt.Close() logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) }() @@ -567,7 +567,7 @@ func TestLowLevelWithoutContext(t *testing.T) { err := tx.Rollback() require.NoError(t, err) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, + {"level": "TRACE", "msg": "Tx.Rollback Start", connIDKey: connIDExpected, txIDKey: txIDExpected}, {"level": "INFO", "msg": "Tx.Rollback Complete", connIDKey: connIDExpected, txIDKey: txIDExpected}, }) }) @@ -592,16 +592,16 @@ func TestLowLevelWithoutContext(t *testing.T) { buf.Reset() assert.NoError(t, stmt.Close()) logs.Assert(t, []map[string]interface{}{ - {"level": "DEBUG", "msg": "Stmt.Close Start", stmtIDKey: stmtIDExpected, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Stmt.Close Complete", stmtIDKey: stmtIDExpected, connIDKey: connIDExpected}, + {"level": "VERBOSE", "msg": "Stmt.Close Start", stmtIDKey: stmtIDExpected, connIDKey: connIDExpected}, + {"level": "DEBUG", "msg": "Stmt.Close Complete", stmtIDKey: stmtIDExpected, connIDKey: connIDExpected}, }) }() logs.Assert(t, []map[string]interface{}{ {"level": "VERBOSE", "msg": "Conn.ResetSession Start", connIDKey: connIDExpected}, {"level": "TRACE", "msg": "Conn.ResetSession Complete", connIDKey: connIDExpected}, - {"level": "DEBUG", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, - {"level": "INFO", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, + {"level": "VERBOSE", "msg": "Conn.PrepareContext Start", "query": query, connIDKey: connIDExpected}, + {"level": "TRACE", "msg": "Conn.PrepareContext Complete", "query": query, connIDKey: connIDExpected, stmtIDKey: stmtIDExpected}, }) t.Run("Stmt.ExecContext", func(t *testing.T) {