Configuration options for SQL logging sessions

interface SqlLoggingOptions {
    batchSeparator?: string;
    defaultSchemaName?: string;
    description?: string;
    filterByUserId?: string;
    filterPatterns?: (string | RegExp)[];
    filterType?: "include" | "exclude";
    formatAsMigration?: boolean;
    logRecordChangeMetadata?: boolean;
    prettyPrint?: boolean;
    retainEmptyLogFiles?: boolean;
    sessionName?: string;
    statementTypes?: "queries" | "mutations" | "both";
    verboseOutput?: boolean;
}

Properties

batchSeparator?: string

Optional batch separator to emit after each statement (e.g., "GO" for SQL Server)

defaultSchemaName?: string

Optional default schema name to use for Flyway migrations for replacing schema names with the placeholder ${flyway:defaultSchema}

description?: string

Optional description to include as a comment at the start of the log

filterByUserId?: string

Optional user ID to filter SQL logging - only log SQL executed by this user

filterPatterns?: (string | RegExp)[]

Array of patterns to filter SQL statements. Supports both regex (RegExp objects) and simple wildcard patterns (strings). How these patterns are applied depends on filterType.

String patterns support:

  • Simple wildcards: "AIPrompt", "spCreate*", "*Run"
  • Regex strings: "/spCreate.*Run/i", "/^SELECT.*FROM/i"

RegExp examples:

  • /spCreateAIPromptRun/i - Match stored procedure calls
  • /^SELECT.*FROM.*vw.*Metadata/i - Match metadata view queries
  • /INSERT INTO EntityFieldValue/i - Match specific inserts
filterType?: "include" | "exclude"

Determines how filterPatterns are applied:

  • 'exclude': If ANY pattern matches, the SQL is NOT logged (default)
  • 'include': If ANY pattern matches, the SQL IS logged

Note: If filterPatterns is empty/undefined, all SQL is logged regardless of filterType.

formatAsMigration?: boolean

Whether to format output as a flyway migration file with schema placeholders

logRecordChangeMetadata?: boolean

Whether to log record change metadata wrapper SQL (default: false). When false, only core spCreate/spUpdate/spDelete calls are logged

prettyPrint?: boolean

Whether to pretty print SQL statements with proper formatting

retainEmptyLogFiles?: boolean

Whether to retain log files that contain no SQL statements (default: false). When false, empty log files are automatically deleted on dispose

sessionName?: string

Optional friendly name for this logging session (for UI display)

statementTypes?: "queries" | "mutations" | "both"

Which types of statements to log: 'queries' (all), 'mutations' (only data changes), 'both' (default)

verboseOutput?: boolean

Whether to output verbose debug information to console (default: false)