func (m *mysqlReporter) LogViolation(ctx context.Context, baseURL, summary, fullURL, details string) {
	now := time.Now()
	glog.Infof("[%s] %s: %s (url=%s)\n  %s", now, baseURL, summary, fullURL, details)
	if _, err := m.stmt.ExecContext(ctx, now, m.source, baseURL, summary, true  , fullURL, details); err != nil {
		glog.Errorf("failed to insert incident for %q: %v", m.source, err)
	}
}
LogViolation records an incident with the given details.
package mysql
import (
	"context"
	"database/sql"
	"fmt"
	"time"
	"github.com/golang/glog"
	"github.com/google/monologue/incident"
)
type mysqlReporter struct {
	db     *sql.DB
	stmt   *sql.Stmt
	source string
}
func NewMySQLReporter(ctx context.Context, db *sql.DB, source string) (incident.Reporter, error) {
	stmt, err := db.PrepareContext(ctx, "INSERT INTO Incidents(Timestamp, Source, BaseURL, Summary, IsViolation, FullURL, Details) VALUES (?, ?, ?, ?, ?, ?, ?);")
	if err != nil {
		return nil, fmt.Errorf("failed to prepare context for %q: %v", source, err)
	}
	return &mysqlReporter{db: db, source: source, stmt: stmt}, nil
}
func (m *mysqlReporter) LogUpdate(ctx context.Context, baseURL, summary, fullURL, details string) {
	now := time.Now()
	glog.Errorf("[%s] %s: %s (url=%s)\n  %s", now, baseURL, summary, fullURL, details)
	if _, err := m.stmt.ExecContext(ctx, now, m.source, baseURL, summary, false  , fullURL, details); err != nil {
		glog.Errorf("failed to insert incident for %q: %v", m.source, err)
	}
}