ispectify library

Classes

AnsiPen
Pen attributes for foreground and background colors.
BaseNetworkInterceptorSettings
Base settings class for network interceptors (Dio, HTTP, etc.).
BaseNetworkInterceptorSettingsBuilder<B extends BaseNetworkInterceptorSettingsBuilder<B, TReq, TRes, TErr>, TReq, TRes, TErr>
Base builder for network interceptor settings.
CategoryFilter
Matches logs whose TraceKeys.category is in categories.
CompositeRedactionStrategy
Runs multiple strategies in order and returns the first redaction result.
ConsoleSettings
Configuration settings for ISpectLogger logger.
ConsoleUtils
Static helpers for console output: border lines and ANSI color mapping.
CorrelationFilter
Matches logs with a specific TraceKeys.correlationId.
CurlUtils
Utility class for generating cURL commands from HTTP request data.
DefaultISpectLoggerHistory
In-memory ILogHistory backed by a ListQueue.
ExtendedLoggerFormatter
Renders single-line logs verbatim and indents continuation lines of multi-line payloads (e.g. network curl dumps, JSON bodies).
FakeISpectLogger
Test double for ISpectLogger. Captures all logs for assertions.
FileLogHistory
Extended ILogHistory with daily file-based persistence.
Filter<T>
A generic filter that checks whether a given item satisfies certain conditions. Used as a building block for more specific filter types.
HeaderRedactionResult
The outcome of a header redaction operation.
HttpMethodFilter<T>
Passes only events whose HTTP method is in allowedMethods.
HumanLogEntryFormatter
Human-readable, grep-friendly console output.
ILogEntryFormatter
Renders a full ISpectLogData entry into a console-ready string.
ILoggerFilter
Determines whether a log message should be recorded based on its content and log level.
ILoggerFormatter
Converts LogDetails into a formatted string for console output.
ILogHistory
Contract for log history storage.
ISpectBaseLogger
Console logger: formats messages via ILoggerFormatter and writes them through a LoggerOutput function.
ISpectDateTimeFormatter
A utility class for formatting DateTime objects into readable strings.
ISpectErrorHandler
A utility class for handling errors and exceptions in ISpectLogger.
ISpectFilter
Composite filter combining log-type-key, runtime type, and search criteria.
ISpectLogData
Core log entry model. All fields are immutable after construction.
ISpectLogDataJsonUtils
Utility class for ISpectLogData JSON operations.
ISpectLogError
Log entry produced when a Dart Error is captured by the logger.
ISpectLogException
Log entry produced when a Dart Exception is captured by the logger.
ISpectLogger
A customizable logging and inspection utility for mobile applications.
ISpectLoggerOptions
Configuration options for ISpectLogger logging.
ISpectLogType
Describes a log type — built-in or user-defined.
ISpectObserver
Observer for monitoring ISpectLogger events.
ISpectTraceCategory
Defines a trace category for grouping related log entries.
ISpectTraceConfig
Base configuration for trace operations.
ISpectTraceToken
Token returned by traceStart for manual span timing.
JsonTruncator
Pretty-prints JSON objects with depth and size limits.
KeyBasedRedaction
Redacts values based on key names: fully-masked keys and sensitive keys.
LogDetails
LogExporter
Utility class for batch export of log data.
LogLevelRangeFilter
Filters logs by a LogLevel range (inclusive).
LogTypeKeyFilter
Matches ISpectLogData items whose ISpectLogData.key is in keys.
NetworkFilter<T>
Base class for network filter chain units.
NetworkFilterChain<T>
Immutable, ordered chain of NetworkFilters with short-circuit evaluation.
NetworkJsonKeys
Canonical JSON key names used across all network interceptor packages.
NetworkLogPrintOptions
Abstraction describing print preferences and color configuration for network-related logs.
NetworkLogRenderer
Builds the verbose body section (status / payload / headers / error info) of a network log entry from its ISpectLogData.additionalData.
NetworkMapRedactor
Standard redaction pipeline for network toJson() maps.
NetworkPayloadSanitizer
Provides reusable sanitization helpers for network payloads.
NetworkTransaction
Groups a correlated HTTP request with its response or error.
PatternBasedRedaction
Redacts values based on content patterns (tokens, JWTs, base64, binary).
RedactionContext
Provides redaction helpers and configuration to strategies at call-time.
RedactionResult
The outcome of a redaction operation: the redacted data and statistics about what was redacted.
RedactionService
A configurable service that redacts sensitive values in headers and payloads.
RedactionStats
Lightweight counters tracking what a single redaction traversal redacted.
RedactionStrategy
Redaction strategy interface.
SamplingFilter<T>
Logs only every sampleRate-th event (1-based counting).
SearchFilter
Case-insensitive search across all fields of ISpectLogData, including nested ISpectLogData.additionalData.
SessionStatistics
Snapshot of session metrics and configuration.
SourceFilter
Matches logs whose TraceKeys.source is in sources.
StatusCodeFilter<T>
Passes only events whose HTTP status code satisfies predicate.
TraceCategoryIds
Single source of truth for category ID strings.
TraceKeys
Top-level keys in ISpectLogData.additionalData for trace envelope.
TransactionFilter
Matches logs with a specific TraceKeys.transactionId.
TypeFilter
Matches ISpectLogData items whose runtime type is in types.
UrlExclusionFilter<T>
Suppresses logging for URLs matching any of excludedPatterns.

Enums

LogLevel
SessionCleanupStrategy
Strategy for cleaning up old log files when session limit is exceeded.

Mixins

BaseNetworkInterceptor
Facade mixin combining NetworkLoggerMixin, NetworkRedactionMixin, and NetworkConfigurationMixin for backward compatibility.
NetworkConfigurationMixin
Mixin providing runtime reconfiguration for network interceptors.
NetworkLoggerMixin
Mixin providing core logging utilities for network interceptors.
NetworkRedactionMixin
Mixin providing redaction utilities for network interceptors.

Extensions

ISpectDataX on ISpectLogData
Utility extensions on ISpectLogData: copy, formatting, cURL generation.
ISpectLogDataSerialization on ISpectLogData
Extension for ISpectLogData to add serialization support.
ISpectLogDataX on ISpectLogData
Convenience getters for accessing structured trace data in ISpectLogData.
ISpectLoggerAnalytics on ISpectLogger
Trace helpers for analytics events (screen views, product impressions, etc.).
ISpectLoggerAuth on ISpectLogger
Trace helpers for authentication flows (sign-in, sign-out, refresh, etc.).
ISpectLoggerGraphQL on ISpectLogger
Trace helpers for GraphQL queries, mutations, and subscriptions.
ISpectLoggerGrpc on ISpectLogger
Trace helpers for gRPC calls.
ISpectLoggerNavigation on ISpectLogger
Trace helpers for Navigator / router transitions.
ISpectLoggerNetwork on ISpectLogger
Trace helpers for raw HTTP request / response / error events.
ISpectLoggerPayment on ISpectLogger
Trace helpers for payment and in-app purchase flows.
ISpectLoggerPush on ISpectLogger
Trace helpers for push / remote notifications.
ISpectLoggerSSE on ISpectLogger
Trace helpers for Server-Sent Events (SSE) streams.
ISpectLoggerState on ISpectLogger
Trace helpers for state-management layers (BLoC, Cubit, Riverpod, etc.).
ISpectLoggerStorage on ISpectLogger
Trace helpers for object-storage / file-storage operations (S3, Firebase Storage, local fs, etc.).
ISpectLoggerWs on ISpectLogger
Trace helpers for WebSocket send / receive events.
ISpectStringExtension on String?
An extension on nullable String providing truncation.
ISpectTrace on ISpectLogger
LogLevelX on LogLevel
SafeLogExtension on ISpectLogger
Extension on ISpectLogger providing safe logging helpers.

Constants

ansi_default → const String
ansi_esc → const String
ansiDefault → const String
Reset all colors and options for current SGRs to terminal defaults.
ansiEscape → const String
ANSI Control Sequence Introducer, signals the terminal for new settings.
ansiResetBackground → const String
Ansi codes that default the terminal's background color without altering the foreground, when printed.
ansiResetForeground → const String
Ansi codes that default the terminal's foreground color without altering the background, when printed.
conversionFailedPlaceholder → const String
Placeholder used when map/data conversion fails during sanitization.
cookieHeaderKey → const String
Header key name requiring special cookie-aware masking (case-insensitive comparison by caller).
defaultFullyMaskedKeys → const Set<String>
Keys whose values are always fully replaced with placeholder (no partial masking), regardless of whether the key is also in defaultSensitiveKeys.
defaultPlaceholder → const String
Default placeholder text substituted for redacted values.
defaultSensitiveKeys → const Set<String>
The canonical set of sensitive key names used for redaction across all ispect packages. This is the single source of truth — other packages (e.g. ispectify_db) reference this constant instead of maintaining their own lists.
kDefaultSensitiveKeys → const Set<String>
Backward-compatible alias for defaultSensitiveKeys.
kDefaultStackFrameLimit → const int
Default maximum stack frames passed to the console logger.
kDefaultStringTruncateLimit → const int
Default truncation limit for strings across the package.
kISpectEnabled → const bool
Compile-time constant to enable/disable ISpect via --dart-define.
redactedMask → const String
Short mask used for key-based redaction (e.g. passwords, tokens).
redactionFailedPlaceholder → const String
Placeholder returned when redaction itself throws an exception.
userInfoRedactedPlaceholder → const String
URI-safe placeholder for redacted userInfo (username:password) in URLs.

Properties

analyticsCategory ISpectTraceCategory
NB: analytics uses one key for success and error. Intentional — analytics events rarely have distinct error types.
final
ansiColorDisabled bool
Globally enable or disable AnsiPen settings.
getter/setter pair
ansiEscapePattern RegExp
Matches standard ANSI SGR / cursor escape sequences.
final
authCategory ISpectTraceCategory
final
base64Regex RegExp
Characters valid in standard or URL-safe Base64.
final
color_disabled bool
getter/setter pair
dbCategory ISpectTraceCategory
final
defaultSensitiveKeyPatterns List<RegExp>
Regex patterns that match sensitive key name fragments.
final
graphqlCategory ISpectTraceCategory
final
grpcCategory ISpectTraceCategory
final
jwtRegex RegExp
JSON Web Token (three dot-separated Base64URL segments).
final
NB: navigation — route push and pop are linked via correlationId.
final
networkCategory ISpectTraceCategory
Predefined trace categories for built-in domains.
final
paymentCategory ISpectTraceCategory
final
pushCategory ISpectTraceCategory
final
schemeRegex RegExp
HTTP authentication scheme prefixes (Bearer, Basic, Digest, etc.).
final
sseCategory ISpectTraceCategory
final
stateCategory ISpectTraceCategory
final
storageCategory ISpectTraceCategory
final
tokenPrefixRegex RegExp
Well-known token prefixes from popular services.
final
urlPattern RegExp
HTTP(S) URLs embedded in free-form text (error messages, logs, etc.).
final
whitespaceRegex RegExp
Any whitespace character (used to sanitize before Base64 checks).
final
wsCategory ISpectTraceCategory
final

Functions

base64Placeholder(int length) String
Placeholder for redacted Base64-encoded data, showing approximate length.
binaryPlaceholder(int length) String
Placeholder for redacted binary data, preserving the original byte count.
cleanMap(Map<String, Object?> map) Map<String, Object?>
Removes entries with null values or empty-string values from map.
containsAnsi(String value) bool
Returns true if value contains any ANSI escape sequence.
formatBytes(int bytes) String
Formats a byte count as a human-readable string (B, KB, MB, GB).
generateTraceId() String
Generates a 16-character hex trace ID from the current timestamp and a random component.
normalizeStackTrace(StackTrace? stackTrace) StackTrace?
Returns stackTrace as-is unless it is null or StackTrace.empty, in which case null is returned.
resetBackground() String
resetForeground() String
samplePass(double? rate) bool
Returns true when the operation should proceed based on a probabilistic sampling rate.
stripAnsi(String value) String
Returns value with all ANSI escape sequences removed.
truncateLeaves(Object? input, {required int maxLength}) Object?
Recursively truncates string leaves in nested Map/Iterable structures.
truncateStackTrace(StackTrace? stackTrace, {int maxFrames = kDefaultStackFrameLimit}) StackTrace?
Truncates stackTrace to maxFrames frames while keeping it a proper StackTrace so that tools like Flutter DevTools can still parse and display clickable frame links.
truncateString(String value, {int maxLength = kDefaultStringTruncateLimit}) String
Truncates value to maxLength, avoiding surrogate pair splits.

Typedefs

ISpectObserverDisposer = void Function()
LoggerOutput = void Function(String message, {Object? error, LogLevel? logLevel, StackTrace? stackTrace, DateTime? time})
Callback signature for custom log output.