FakeISpectLogger class

Test double for ISpectLogger. Captures all logs for assertions.

Uses Queue (O(1) removeFirst) for FIFO rotation with maxTraces.

Inheritance
Available extensions

Constructors

FakeISpectLogger({int maxTraces = 10000})

Properties

fileLogHistory FileLogHistory?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasObservers bool
Indicates whether at least one observer is registered.
no setterinherited
history List<ISpectLogData>
List of all log entries stored in history.
no setterinherited
isDisposed bool
Indicates whether this logger has been disposed and can no longer emit logs.
no setterinherited
lastTrace ISpectLogData?
no setter
logHistory ILogHistory
no setterinherited
maxTraces int
final
options ISpectLoggerOptions
Current configuration options for this inspector instance.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<ISpectLogData>
Stream controller for broadcasting log events. Stream of log data that can be subscribed to for real-time monitoring.
no setterinherited
traces List<ISpectLogData>
Read-only snapshot as List.
no setter

Methods

addObserver(ISpectObserver observer) → void
Adds an observer to be notified of log events.
inherited
analyticsEvent({required String source, required String event, Map<String, Object?>? parameters, ISpectTraceConfig? config, String? correlationId}) → void

Available on ISpectLogger, provided by the ISpectLoggerAnalytics extension

Logs an analytics event under analyticsCategory.
auth({required String source, required String operation, String? userId, String? provider, bool? success, Object? error, Duration? duration, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId}) → void

Available on ISpectLogger, provided by the ISpectLoggerAuth extension

Logs a one-shot auth event without awaiting a future.
authTrace<T>({required String source, required String operation, required Future<T> run(), String? userId, String? provider, Map<String, Object?>? meta, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerAuth extension

Traces an async auth operation under authCategory.
byCategory(String category) List<ISpectLogData>
byCorrelationId(String correlationId) List<ISpectLogData>
byLogKey(String logKey) List<ISpectLogData>
byLogLevel(LogLevel level) List<ISpectLogData>
byOperation(String operation) List<ISpectLogData>
bySource(String source) List<ISpectLogData>
byTransactionId(String transactionId) List<ISpectLogData>
clearFilter() → void
Removes the current filter so that all logs are processed.
inherited
clearHistory() → void
Clears all log entries from history.
inherited
clearObservers() → void
Removes all registered observers.
inherited
configure({ISpectBaseLogger? logger, ISpectLoggerOptions? options, ISpectObserver? observer, ISpectFilter? filter, ISpectErrorHandler? errorHandler, ILogHistory? history}) → void
Reconfigures the inspector with new components.
inherited
critical(Object? msg, {Object? exception, StackTrace? stackTrace, Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates a critical level log entry.
inherited
debug(Object? msg, {Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates a debug level log entry.
inherited
disable() → void
Disables the inspector.
inherited
dispose() Future<void>
Releases resources held by this logger.
inherited
enable() → void
Enables the inspector.
inherited
error(Object? msg, {Object? exception, StackTrace? stackTrace, Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates an error level log entry.
inherited
errors() List<ISpectLogData>
good(Object? message) → void
Creates a "good" log entry.
inherited
graphqlTrace<T>({required String source, required String operation, required Future<T> run(), String? operationName, String? document, Map<String, Object?>? variables, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerGraphQL extension

Traces an async GraphQL operation under graphqlCategory.
grpcTrace<T>({required String source, required String operation, required Future<T> run(), String? service, String? method, Map<String, Object?>? grpcMetadata, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerGrpc extension

Traces an async gRPC call under grpcCategory.
handle({required Object exception, StackTrace? stackTrace, Object? message}) → void
Handles exceptions and errors.
inherited
httpError({required String source, required String operation, String? target, Object? error, StackTrace? errorStackTrace, Duration? duration, String? correlationId, Map<String, Object?>? meta, ISpectTraceConfig? config, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerNetwork extension

Logs an HTTP error (4xx/5xx or transport failure) under networkCategory.
httpRequest({required String source, required String operation, String? target, String? correlationId, Map<String, Object?>? meta, ISpectTraceConfig? config, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerNetwork extension

Logs an outgoing HTTP request under networkCategory.
httpResponse({required String source, required String operation, String? target, Duration? duration, String? correlationId, Map<String, Object?>? meta, ISpectTraceConfig? config, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerNetwork extension

Logs an HTTP response (2xx/3xx) under networkCategory.
info(Object? msg, {Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates an info level log entry.
inherited
lastByCategory(String category) ISpectLogData?
log(Object? message, {LogLevel? logLevel, ISpectLogType? type, Object? exception, StackTrace? stackTrace, AnsiPen? pen, Map<String, dynamic>? additionalData}) → void
Creates a log entry with custom parameters.
inherited
logData(ISpectLogData log) → void
Logs a custom ISpectLogData instance directly.
override

Available on ISpectLogger, provided by the ISpectLoggerNavigation extension

Logs a navigation event under navigationCategory.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observe(ISpectObserver observer) ISpectObserverDisposer
Registers an observer and returns a disposer to remove it later.
inherited
paymentTrace<T>({required String source, required String operation, required Future<T> run(), String? productId, double? amount, String? currency, Map<String, Object?>? meta, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerPayment extension

Traces an async payment operation under paymentCategory.
print(Object? message) → void
Creates a basic print log entry.
inherited
provider(Object? message) → void
Creates a provider log entry.
inherited
push({required String source, required String operation, String? title, String? topic, String? messageId, Map<String, Object?>? data, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId}) → void

Available on ISpectLogger, provided by the ISpectLoggerPush extension

Logs a push notification event under pushCategory.
removeObserver(ISpectObserver observer) → void
Removes an observer from the list of registered observers.
inherited
reset() → void
route(Object? message, {String? transitionId}) → void
Creates a route log entry.
inherited
safeLogData(ISpectLogData data) → void

Available on ISpectLogger, provided by the SafeLogExtension extension

Logs data inside a try-catch, preventing logger exceptions from propagating into the caller's framework.
slow() List<ISpectLogData>
sse({required String source, required String operation, String? url, String? eventType, String? eventId, Object? error, StackTrace? errorStackTrace, Map<String, Object?>? data, ISpectTraceConfig? config, String? correlationId}) → void

Available on ISpectLogger, provided by the ISpectLoggerSSE extension

Logs an SSE event under sseCategory.
stateChange({required String source, required String operation, String? stateName, bool? success, Object? fromState, Object? toState, String? event, Object? error, StackTrace? errorStackTrace, Duration? duration, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerState extension

Logs a state-change event (transition) under stateCategory.
stateTrace<T>({required String source, required String operation, required Future<T> run(), String? stateName, Map<String, Object?>? meta, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerState extension

Traces an async state operation under stateCategory.
storage({required String source, required String operation, String? bucket, String? path, int? sizeBytes, String? contentType, bool? success, Object? error, Duration? duration, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId}) → void

Available on ISpectLogger, provided by the ISpectLoggerStorage extension

Logs a one-shot storage event without awaiting a future.
storageTrace<T>({required String source, required String operation, required Future<T> run(), String? bucket, String? path, int? sizeBytes, String? contentType, Map<String, Object?>? meta, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectLoggerStorage extension

Traces an async storage operation under storageCategory.
toString() String
A string representation of this object.
inherited
trace({required ISpectTraceCategory category, required String source, required String operation, String? target, String? key, Object? value, bool? success, Object? error, StackTrace? errorStackTrace, Duration? duration, Map<String, Object?>? meta, double? sample, ISpectTraceConfig? config, String? logKey, String? correlationId, LogLevel? logLevel, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectTrace extension

traceAsync<T>({required ISpectTraceCategory category, required String source, required String operation, required Future<T> run(), String? target, String? key, Map<String, Object?>? meta, Object? projectResult(T value)?, double? sample, ISpectTraceConfig? config, String? logKey, LogLevel? logLevel, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectTrace extension

traceCategory({required ISpectTraceCategory category, required String source, required String operation, String? target, String? key, bool? success, Object? error, StackTrace? errorStackTrace, Duration? duration, Map<String, Object?>? meta, ISpectTraceConfig? config, String? logKey, String? correlationId, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectTrace extension

Convenience wrapper: checks options.enabled, then delegates to trace.
traceCategoryAsync<T>({required ISpectTraceCategory category, required String source, required String operation, required Future<T> run(), String? target, Map<String, Object?>? meta, Object? projectResult(T)?, ISpectTraceConfig? config, String? correlationId}) Future<T>

Available on ISpectLogger, provided by the ISpectTrace extension

Convenience wrapper: checks options.enabled, then delegates to traceAsync.
traceEnd(ISpectTraceToken? token, {Object? value, bool? success, Object? error, StackTrace? errorStackTrace, Map<String, Object?>? meta}) → void

Available on ISpectLogger, provided by the ISpectTrace extension

Ends a manual span. token is nullable — if traceStart returned null (logger disabled), this is a no-op.
traceStart({required ISpectTraceCategory category, required String source, required String operation, String? target, String? key, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId}) ISpectTraceToken?

Available on ISpectLogger, provided by the ISpectTrace extension

Returns null if logger is disabled — caller must check.
traceStream<T>({required ISpectTraceCategory category, required String source, required String operation, required Stream<T> stream, String? target, String? key, Map<String, Object?>? meta, Object? projectEvent(T value)?, double? sample, ISpectTraceConfig? config, String? correlationId}) Stream<T>

Available on ISpectLogger, provided by the ISpectTrace extension

traceSync<T>({required ISpectTraceCategory category, required String source, required String operation, required T run(), String? target, String? key, Map<String, Object?>? meta, Object? projectResult(T value)?, double? sample, ISpectTraceConfig? config, String? logKey, String? correlationId, LogLevel? logLevel}) → T

Available on ISpectLogger, provided by the ISpectTrace extension

traceTransaction<T>({required ISpectTraceCategory category, required String source, required Future<T> run(), bool logMarkers = false}) Future<T>

Available on ISpectLogger, provided by the ISpectTrace extension

Runs run inside a zone with auto-injected transaction ID.
track(Object? message, {String? event, String? analytics, Map<String, dynamic>? parameters}) → void
Creates an analytics tracking log entry.
inherited
verbose(Object? msg, {Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates a verbose level log entry.
inherited
warning(Object? msg, {Map<String, dynamic>? additionalData, AnsiPen? pen}) → void
Creates a warning level log entry.
inherited
wsReceive({required String source, required String operation, String? target, String? eventType, int? sizeBytes, Object? error, StackTrace? errorStackTrace, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerWs extension

Logs an inbound WebSocket message under wsCategory.
wsSend({required String source, required String operation, String? target, String? eventType, int? sizeBytes, Object? error, StackTrace? errorStackTrace, Map<String, Object?>? meta, ISpectTraceConfig? config, String? correlationId, String? consoleMessage}) → void

Available on ISpectLogger, provided by the ISpectLoggerWs extension

Logs an outbound WebSocket message under wsCategory.

Operators

operator ==(Object other) bool
The equality operator.
inherited