logging

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const WafflesSchema = `` /* 3199-byte string literal not displayed */

WafflesSchema contains all SQL statements for Waffles-specific tables

Variables

View Source
var MigrationQueries = map[int]string{
	1: WafflesSchema,
}

MigrationQueries contains versioned migration queries

Functions

func GetCurrentSchemaVersion

func GetCurrentSchemaVersion() int

GetCurrentSchemaVersion returns the current schema version

func GetMigrationQuery

func GetMigrationQuery(version int) (string, bool)

GetMigrationQuery returns the migration query for a specific version

func GetRequiredMigrations

func GetRequiredMigrations(currentVersion, targetVersion int) []string

GetRequiredMigrations returns all migrations needed from current to target version

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database represents the SQLite logging database

func NewDatabase

func NewDatabase(path string) (*Database, error)

NewDatabase creates a new database instance and initializes the schema

func (*Database) Close

func (d *Database) Close() error

Close closes the database connection

func (*Database) CountExecutions

func (d *Database) CountExecutions(filter *ExecutionFilter) (int, error)

CountExecutions returns the count of executions matching the filter

func (*Database) ExportExecutions

func (d *Database) ExportExecutions(options *ExportOptions, writer io.Writer) error

ExportExecutions exports execution data to various formats

func (*Database) GetDB

func (d *Database) GetDB() *sql.DB

GetDB returns the underlying sql.DB connection for advanced operations

func (*Database) GetExecution

func (d *Database) GetExecution(id string) (*WafflesExecution, error)

GetExecution retrieves a single execution by ID

func (*Database) GetExecutionFiles

func (d *Database) GetExecutionFiles(executionID string) ([]WafflesFile, error)

GetExecutionFiles retrieves all files for an execution

func (*Database) GetExecutionStats

func (d *Database) GetExecutionStats(filter *ExecutionFilter) (*ExecutionStats, error)

GetExecutionStats calculates statistics about executions

func (*Database) GetExecutionSteps

func (d *Database) GetExecutionSteps(executionID string) ([]WafflesStep, error)

GetExecutionSteps retrieves all steps for an execution

func (*Database) GetPath

func (d *Database) GetPath() string

GetPath returns the database file path

func (*Database) InitializeSchema

func (d *Database) InitializeSchema() error

InitializeSchema creates tables and runs migrations

func (*Database) LogExecution

func (d *Database) LogExecution(exec *WafflesExecution) error

LogExecution records a complete Waffles execution

func (*Database) LogFiles

func (d *Database) LogFiles(executionID string, files []WafflesFile) error

LogFiles records files processed during an execution

func (*Database) LogSteps

func (d *Database) LogSteps(executionID string, steps []WafflesStep) error

LogSteps records individual tool executions within a pipeline

func (*Database) QueryExecutions

func (d *Database) QueryExecutions(filter *ExecutionFilter) ([]WafflesExecution, error)

QueryExecutions retrieves executions based on filter criteria

func (*Database) UpdateExecution

func (d *Database) UpdateExecution(exec *WafflesExecution) error

UpdateExecution updates an existing execution record

type ExecutionFilter

type ExecutionFilter struct {
	DateFrom    *time.Time `json:"date_from,omitempty"`
	DateTo      *time.Time `json:"date_to,omitempty"`
	Language    string     `json:"language,omitempty"`
	Model       string     `json:"model,omitempty"`
	Provider    string     `json:"provider,omitempty"`
	Success     *bool      `json:"success,omitempty"`
	MinDuration *int64     `json:"min_duration,omitempty"`
	MaxDuration *int64     `json:"max_duration,omitempty"`
	SearchQuery string     `json:"search_query,omitempty"`
	Limit       int        `json:"limit,omitempty"`
	Offset      int        `json:"offset,omitempty"`
}

ExecutionFilter represents filtering criteria for querying executions

type ExecutionStats

type ExecutionStats struct {
	TotalExecutions      int            `json:"total_executions"`
	SuccessfulExecutions int            `json:"successful_executions"`
	FailedExecutions     int            `json:"failed_executions"`
	AverageExecutionTime float64        `json:"average_execution_time_ms"`
	TotalFiles           int            `json:"total_files"`
	LanguageBreakdown    map[string]int `json:"language_breakdown"`
	ModelBreakdown       map[string]int `json:"model_breakdown"`
	ProviderBreakdown    map[string]int `json:"provider_breakdown"`
}

ExecutionStats represents statistics about executions

type ExportFormat

type ExportFormat string

ExportFormat represents supported export formats

const (
	ExportFormatJSON     ExportFormat = "json"
	ExportFormatCSV      ExportFormat = "csv"
	ExportFormatMarkdown ExportFormat = "markdown"
	ExportFormatSQL      ExportFormat = "sql"
)

type ExportOptions

type ExportOptions struct {
	Format       ExportFormat     `json:"format"`
	Filter       *ExecutionFilter `json:"filter,omitempty"`
	IncludeFiles bool             `json:"include_files"`
	IncludeSteps bool             `json:"include_steps"`
	Compress     bool             `json:"compress"`
	Template     string           `json:"template,omitempty"`
}

ExportOptions represents options for exporting data

type WafflesExecution

type WafflesExecution struct {
	ID                  string    `json:"id"`
	ConversationID      string    `json:"conversation_id"`
	CommandArgs         string    `json:"command_args"`
	WheresmypromptQuery string    `json:"wheresmyprompt_query"`
	Files2promptArgs    string    `json:"files2prompt_args"`
	LLMArgs             string    `json:"llm_args"`
	DetectedLanguage    string    `json:"detected_language"`
	FileCount           int       `json:"file_count"`
	ExecutionTimeMS     int64     `json:"execution_time_ms"`
	Success             bool      `json:"success"`
	ErrorMessage        string    `json:"error_message,omitempty"`
	ModelUsed           string    `json:"model_used"`
	ProviderUsed        string    `json:"provider_used"`
	Created             time.Time `json:"created"`
	Updated             time.Time `json:"updated"`
}

WafflesExecution represents a complete Waffles pipeline execution

type WafflesFile

type WafflesFile struct {
	ID              string    `json:"id"`
	ExecutionID     string    `json:"execution_id"`
	FilePath        string    `json:"file_path"`
	FileSize        int64     `json:"file_size"`
	Included        bool      `json:"included"`
	ExclusionReason string    `json:"exclusion_reason,omitempty"`
	Created         time.Time `json:"created"`
}

WafflesFile represents a file that was processed during execution

type WafflesStep

type WafflesStep struct {
	ID          string    `json:"id"`
	ExecutionID string    `json:"execution_id"`
	Tool        string    `json:"tool"`
	Command     string    `json:"command"`
	Output      string    `json:"output"`
	ErrorOutput string    `json:"error_output,omitempty"`
	Success     bool      `json:"success"`
	DurationMS  int64     `json:"duration_ms"`
	StepOrder   int       `json:"step_order"`
	Created     time.Time `json:"created"`
}

WafflesStep represents individual tool execution within a pipeline

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL