11package log
22
33import (
4- "fmt"
54 "time"
65
76 "github.com/ydb-platform/ydb-go-sdk/v3/trace"
@@ -10,18 +9,10 @@ import (
109// Table makes trace.Table with internal logging
1110// nolint: gocyclo
1211func Table (log Logger , details trace.Details ) trace.Table {
13- log , ok := log .WithName (`table` ).(Logger )
14- if ! ok {
15- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
16- }
12+ log = log .WithName (`table` )
1713 t := trace.Table {}
18- // nolint: nestif
1914 if details & trace .TablePoolRetryEvents != 0 {
20- // nolint: govet
21- log , ok := log .WithName (`retry` ).(Logger )
22- if ! ok {
23- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
24- }
15+ log = log .WithName (`retry` )
2516 // nolint: lll
2617 t .OnPoolRetry = func (info trace.PoolRetryStartInfo ) func (info trace.PoolRetryInternalInfo ) func (trace.PoolRetryDoneInfo ) {
2718 idempotent := info .Idempotent
@@ -63,11 +54,7 @@ func Table(log Logger, details trace.Details) trace.Table {
6354 }
6455 // nolint: nestif
6556 if details & trace .TableSessionEvents != 0 {
66- // nolint: govet
67- log , ok := log .WithName (`session` ).(Logger )
68- if ! ok {
69- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
70- }
57+ log = log .WithName (`session` )
7158 if details & trace .TableSessionLifeCycleEvents != 0 {
7259 t .OnSessionNew = func (info trace.SessionNewStartInfo ) func (trace.SessionNewDoneInfo ) {
7360 log .Tracef (`create start` )
@@ -136,17 +123,9 @@ func Table(log Logger, details trace.Details) trace.Table {
136123 }
137124 }
138125 if details & trace .TableSessionQueryEvents != 0 {
139- // nolint: govet
140- log , ok := log .WithName (`query` ).(Logger )
141- if ! ok {
142- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
143- }
126+ log = log .WithName (`query` )
144127 if details & trace .TableSessionQueryInvokeEvents != 0 {
145- // nolint: govet
146- log , ok := log .WithName (`invoke` ).(Logger )
147- if ! ok {
148- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
149- }
128+ log = log .WithName (`invoke` )
150129 t .OnSessionQueryPrepare = func (info trace.SessionQueryPrepareStartInfo ) func (trace.PrepareDataQueryDoneInfo ) {
151130 session := info .Session
152131 query := info .Query
@@ -216,11 +195,7 @@ func Table(log Logger, details trace.Details) trace.Table {
216195 }
217196 }
218197 if details & trace .TableSessionQueryStreamEvents != 0 {
219- // nolint: govet
220- log , ok := log .WithName (`stream` ).(Logger )
221- if ! ok {
222- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
223- }
198+ log = log .WithName (`stream` )
224199 // nolint: lll
225200 t .OnSessionQueryStreamExecute = func (info trace.SessionQueryStreamExecuteStartInfo ) func (trace.SessionQueryStreamExecuteDoneInfo ) {
226201 session := info .Session
@@ -284,11 +259,7 @@ func Table(log Logger, details trace.Details) trace.Table {
284259 }
285260 }
286261 if details & trace .TableSessionTransactionEvents != 0 {
287- // nolint: govet
288- log , ok := log .WithName (`transaction` ).(Logger )
289- if ! ok {
290- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
291- }
262+ log = log .WithName (`transaction` )
292263 // nolint: lll
293264 t .OnSessionTransactionBegin = func (info trace.SessionTransactionBeginStartInfo ) func (trace.SessionTransactionBeginDoneInfo ) {
294265 session := info .Session
@@ -377,11 +348,7 @@ func Table(log Logger, details trace.Details) trace.Table {
377348 }
378349 // nolint: nestif
379350 if details & trace .TablePoolEvents != 0 {
380- // nolint: govet
381- log , ok := log .WithName (`pool` ).(Logger )
382- if ! ok {
383- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
384- }
351+ log = log .WithName (`pool` )
385352 if details & trace .TablePoolLifeCycleEvents != 0 {
386353 t .OnPoolInit = func (info trace.PoolInitStartInfo ) func (trace.PoolInitDoneInfo ) {
387354 log .Infof (`initialize start` )
@@ -412,11 +379,7 @@ func Table(log Logger, details trace.Details) trace.Table {
412379 }
413380 }
414381 if details & trace .TablePoolSessionLifeCycleEvents != 0 {
415- // nolint: govet
416- log , ok := log .WithName (`session` ).(Logger )
417- if ! ok {
418- panic (fmt .Sprintf ("%T.WithName() returns interface which not casted to Logger interface" , log ))
419- }
382+ log = log .WithName (`session` )
420383 t .OnPoolSessionNew = func (info trace.PoolSessionNewStartInfo ) func (trace.PoolSessionNewDoneInfo ) {
421384 log .Tracef (`create start` )
422385 start := time .Now ()
0 commit comments