FakeISpectLogger class
Test double for ISpectLogger. Captures all logs for assertions.
Uses Queue (O(1) removeFirst) for FIFO rotation with maxTraces.
- Inheritance
-
- Object
- ISpectLogger
- FakeISpectLogger
- Available extensions
- ISpectLoggerAnalytics
- ISpectLoggerAuth
- ISpectLoggerBloc
- ISpectLoggerGraphQL
- ISpectLoggerGrpc
- ISpectLoggerNavigation
- ISpectLoggerNetwork
- ISpectLoggerPayment
- ISpectLoggerPerformance
- ISpectLoggerPush
- ISpectLoggerRiverpod
- ISpectLoggerSSE
- ISpectLoggerState
- ISpectLoggerStorage
- ISpectLoggerWs
- ISpectTrace
- SafeLogExtension
Constructors
- FakeISpectLogger({int maxTraces = 10000})
-
factory
Properties
- fileLogHistory → FileLogHistory?
-
no setterinherited
- hasActiveConsumers → bool
-
Whether an emitted entry currently has at least one destination.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasObservers → bool
-
no setterinherited
-
history
→ List<
ISpectLogData> -
no setterinherited
- isDisposed → bool
-
Whether this logger has been disposed and can no longer emit logs.
no setterinherited
- isEnabled → bool
-
Whether this logger can currently capture diagnostics.
no setterinherited
- lastTrace → ISpectLogData?
-
no setter
- logHistory → ILogHistory
-
no setterinherited
- maxTraces → int
-
final
- options → ISpectLoggerOptions
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
ISpectLogData> -
Broadcast stream of log events that pass through the filter. Multiple
listeners may subscribe.
no setterinherited
-
traces
→ List<
ISpectLogData> -
Read-only snapshot as List.
no setter
Methods
-
addObserver(
ISpectObserver observer) → void -
Registers an observer. Remains active until removeObserver or
clearObservers is called. Prefer observe when you want automatic
cleanup via a disposer callback.
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. -
blocClose(
{required String source, required String target, Map< String, Object?> ? meta, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonCloseunder stateCategory with thebloc-closekey. -
blocCreate(
{required String source, required String target, Map< String, Object?> ? meta, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonCreateunder stateCategory with thebloc-createkey. -
blocDone(
{required String source, required String target, bool hasError = false, Object? error, StackTrace? errorStackTrace, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonDoneunder stateCategory with thebloc-donekey. -
blocError(
{required String source, required String target, required Object error, StackTrace? errorStackTrace, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonErrorunder stateCategory with thebloc-errorkey. -
blocEvent(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonEventunder stateCategory with thebloc-eventkey. -
blocState(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonChangeunder stateCategory with thebloc-statekey. -
blocTransition(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerBloc extension
LogsonTransitionunder stateCategory with thebloc-transitionkey. -
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 -
inherited
-
clearHistory(
) → void -
inherited
-
clearObservers(
) → void -
inherited
-
configure(
{ISpectBaseLogger? logger, ISpectLoggerOptions? options, ISpectObserver? observer, ISpectFilter? filter, ISpectErrorHandler? errorHandler, ILogHistory? history}) → void -
Replaces only the provided components; others retain their current values.
inherited
-
critical(
Object? msg, {Object? exception, StackTrace? stackTrace, Map< String, dynamic> ? additionalData, AnsiPen? pen}) → void -
inherited
-
debug(
Object? msg, {Map< String, dynamic> ? additionalData, AnsiPen? pen}) → void -
inherited
-
disable(
) → void -
inherited
-
dispose(
) → Future< void> -
Closes the stream, drops observers, releases history resources. After
this call the logger becomes a no-op.
inherited
-
enable(
) → void -
inherited
-
error(
Object? msg, {Object? exception, StackTrace? stackTrace, Map< String, dynamic> ? additionalData, AnsiPen? pen}) → void -
inherited
-
errors(
) → List< ISpectLogData> -
good(
Object? message) → void -
inherited
-
graphqlTrace<
T> ({required String source, required String operation, required Future< T> run(), String? operationName, String? document, Map<String, Object?> ? variables, Map<String, Object?> ? meta, 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 -
Routes
exceptionthrough the configured ISpectErrorHandler to produce a typed log entry.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 -
inherited
-
lastByCategory(
String category) → ISpectLogData? -
log(
Object? message, {LogLevel? logLevel, ISpectLogType? type, Object? exception, StackTrace? stackTrace, AnsiPen? pen, Map< String, dynamic> ? additionalData}) → void -
Logs
messagewith an explicitlogLeveland/ortype. Whentypeis omitted, it is inferred fromlogLevel; when both are omitted, defaults to LogLevel.debug.inherited -
logData(
ISpectLogData log, {bool redact = true}) → void -
Emits a pre-built ISpectLogData entry.
inherited
-
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 - useful
for scoped subscriptions (e.g. widget lifecycle).
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. -
performanceJank(
{required String source, required Duration buildDuration, required Duration rasterDuration, required Duration totalSpan, required Duration targetFrameTime, StackTrace? stackTrace, Map< String, Object?> ? meta, ISpectTraceConfig? config, String? correlationId}) → void -
Available on ISpectLogger, provided by the ISpectLoggerPerformance extension
Logs a jank frame under performanceCategory. -
print(
Object? message) → void -
inherited
-
provider(
Object? message) → void -
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 -
inherited
-
reset(
) → void -
riverpodAdd(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerRiverpod extension
LogsdidAddProviderunder stateCategory with theriverpod-addkey. -
riverpodDispose(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerRiverpod extension
LogsdidDisposeProviderunder stateCategory with theriverpod-disposekey. -
riverpodFail(
{required String source, required String target, required Object error, StackTrace? errorStackTrace, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerRiverpod extension
LogsproviderDidFailunder stateCategory with theriverpod-failkey. -
riverpodUpdate(
{required String source, required String target, Map< String, Object?> ? meta, String? correlationId, ISpectTraceConfig? config, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerRiverpod extension
LogsdidUpdateProviderunder stateCategory with theriverpod-updatekey. -
route(
Object? message, {String? transitionId}) → void -
Emits a navigation entry.
transitionIdcorrelates the entry with a specific transition via TraceKeys.correlationId.inherited -
safeLogData(
ISpectLogData data) → void -
Available on ISpectLogger, provided by the SafeLogExtension extension
Logsdatainside 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, Map<String, Object?> ? meta, 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 ISpectLogger.isEnabled, 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 ISpectLogger.isEnabled, 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.tokenis 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
Returnsnullif 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
Runsruninside a zone with auto-injected transaction ID. -
track(
Object? message, {String? event, String? analytics, Map< String, dynamic> ? parameters}) → void -
Emits an analytics-flavored entry.
eventis the action name,analyticsis the destination service identifier,parametersare forwarded payload.inherited -
verbose(
Object? msg, {Map< String, dynamic> ? additionalData, AnsiPen? pen}) → void -
inherited
-
warning(
Object? msg, {Map< String, dynamic> ? additionalData, AnsiPen? pen}) → void -
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. -
wsState(
{required String source, required String state, String? target, Map< String, Object?> ? meta, ISpectTraceConfig? config, String? correlationId, String? consoleMessage}) → void -
Available on ISpectLogger, provided by the ISpectLoggerWs extension
Logs a WebSocket connection-state change under wsCategory.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited