File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -291,15 +291,23 @@ func NewDefault(provider sql.DatabaseProvider) *Analyzer {
291291// Log prints an INFO message to stdout with the given message and args
292292// if the analyzer is in debug mode.
293293func (a * Analyzer ) Log (msg string , args ... interface {}) {
294- if a != nil && a .Debug {
295- if len (a .contextStack ) > 0 {
296- ctx := strings .Join (a .contextStack , "/" )
297- sanitizedArgs := sanitizeArguments (args )
298- log .Infof ("%s: " + msg , append ([]interface {}{ctx }, sanitizedArgs ... )... )
299- } else {
300- sanitizedArgs := sanitizeArguments (args )
301- log .Infof (msg , sanitizedArgs ... )
294+ if a == nil || ! a .Debug {
295+ return
296+ }
297+
298+ sanitizedArgs := sanitizeArguments (args )
299+
300+ if len (a .contextStack ) > 0 {
301+ ctx := strings .Join (a .contextStack , "/" )
302+ // Create a new slice for the final arguments to avoid direct append with variadic expansion
303+ finalArgs := make ([]interface {}, len (sanitizedArgs )+ 1 )
304+ finalArgs [0 ] = ctx
305+ for i , arg := range sanitizedArgs {
306+ finalArgs [i + 1 ] = arg
302307 }
308+ log .Infof ("%s: " + msg , finalArgs ... )
309+ } else {
310+ log .Infof (msg , sanitizedArgs ... )
303311 }
304312}
305313
You can’t perform that action at this time.
0 commit comments