ISpectLoggerDb extension

Database logging extension on ISpectLogger.

All methods accept an optional config parameter. When omitted, the default ISpectDbConfig is used. Pass a custom config to override sampling, redaction, statement/arg length limits, and transaction marker settings per call-site.

All methods delegate to the unified trace API via trace/traceAsync/ traceTransaction, placing DB-specific data in TraceKeys.meta.

on
  • ISpectLogger

Methods

db({required String source, required String operation, String? statement, String? target, String? table, String? key, Object? value, List<Object?>? args, Map<String, Object?>? namedArgs, bool? success, Object? error, int? affected, int? items, int? sizeBytes, bool? cacheHit, Duration? duration, Map<String, Object?>? meta, Object? projection, double? sample, bool? redact, List<String>? redactKeys, int? maxValueLength, int? maxArgsLength, int? maxStatementLength, String? transactionId, StackTrace? errorStackTrace, ISpectDbConfig config = const ISpectDbConfig()}) → void

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Logs a single database operation via trace.
dbEnd(ISpectDbToken token, {Object? value, bool? success, Object? error, int? affected, int? items, int? sizeBytes, bool? cacheHit, Map<String, Object?>? meta, ISpectDbConfig config = const ISpectDbConfig()}) → void

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Finalizes a span started by dbStart.
dbStart({String? source, String? operation, String? statement, String? target, String? table, String? key, List<Object?>? args, Map<String, Object?>? namedArgs, Map<String, Object?>? meta, String? transactionId}) ISpectDbToken

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Starts a manual span.
dbTrace<T>({required String source, required String operation, required Future<T> run(), String? statement, String? target, String? table, String? key, List<Object?>? args, Map<String, Object?>? namedArgs, Map<String, Object?>? meta, Object? projectResult(T value)?, double? sample, bool? redact, List<String>? redactKeys, int? maxValueLength, int? maxArgsLength, int? maxStatementLength, int? itemsCountFromLength, int? affectedOverride, int? sizeBytes, bool? cacheHit, String? transactionId, ISpectDbConfig config = const ISpectDbConfig()}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Wraps run with automatic timing and delegates to traceAsync.
dbTraceSync<T>({required String source, required String operation, required T run(), String? statement, String? target, String? table, String? key, List<Object?>? args, Map<String, Object?>? namedArgs, Map<String, Object?>? meta, Object? projectResult(T value)?, double? sample, bool? redact, List<String>? redactKeys, int? maxValueLength, int? maxArgsLength, int? maxStatementLength, int? itemsCountFromLength, int? affectedOverride, int? sizeBytes, bool? cacheHit, String? transactionId, ISpectDbConfig config = const ISpectDbConfig()}) → T

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Synchronous version of dbTrace.
dbTransaction<T>({required Future<T> run(), String source = dbDefaultSource, Map<String, Object?>? meta, bool? logMarkers, ISpectDbConfig config = const ISpectDbConfig()}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerDb extension

Runs run inside a transaction zone. Delegates to traceTransaction.