func dumpStmtStats(ctx context.Context, appName string, stats map[stmtKey]*stmtStats) {
	if len(stats) == 0 {
		return
	}
	var buf bytes.Buffer
	for key, s := range stats {
		s.Lock()
		json, err := json.Marshal(s.data)
		s.Unlock()
		if err != nil {
			log.Errorf(ctx, "error while marshaling stats for %q // %q: %v", appName, key.String(), err)
			continue
		}
		fmt.Fprintf(&buf, "%q: %s\n", key.String(), json)
	}
	log.Infof(ctx, "Statistics for %q:\n%s", appName, buf.String())
}
// Save the existing data for an application to the info log.
Save the existing data for an application to the info log.
// Save the existing data for an application to the info log .
func dumpStmtStats(ctx context.Context, appName string, stats map[stmtKey]*stmtStats) {
	if len(stats) == 0 {
		return
	}
	var buf bytes.Buffer
	for key, s := range stats {
		s.Lock()
		json, err := json.Marshal(s.data)
		s.Unlock()
		if err != nil {
			log.Errorf(ctx, "error while marshaling stats for %q // %q: %v", appName, key.String(), err)
			continue
		}
		fmt.Fprintf(&buf, "%q: %s\n", key.String(), json)
	}
	log.Infof(ctx, "Statistics for %q:\n%s", appName, buf.String())
}
func dumpStmtStats ( ctx context . Context , appName string , stats map [ stmtKey ] * stmtStats ) { if len ( stats ) == 0 { return } var buf bytes . Buffer for key , s := range stats { s . Lock ( ) json , err := json . Marshal ( s . data ) s . Unlock ( ) if err != nil { log . Errorf ( ctx , " " , appName , key . String ( ) , err ) continue } fmt . Fprintf ( & buf , " \n " , key . String ( ) , json ) } log . Infof ( ctx , " \n " , appName , buf . String ( ) ) }
Save the existing data for an application to the info log.
Save the existing data for an application to the info log .