github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/core/database/logger.go (about)

     1  // Copyright 2023 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package database
     5  
     6  // SlowQueryLogger is a logger that can be used to log slow operations.
     7  type SlowQueryLogger interface {
     8  	// Log the slow query, with the given arguments.
     9  	RecordSlowQuery(msg, stmt string, args []any, duration float64)
    10  }
    11  
    12  // NoopSlowQueryLogger is a logger that can be substituted for a SlowQueryLogger
    13  // when slow query logging is not desired.
    14  type NoopSlowQueryLogger struct{}
    15  
    16  // Log the slow query, with the given arguments.
    17  func (NoopSlowQueryLogger) RecordSlowQuery(msg, stmt string, args []any, duration float64) {}