dart_auto_logger 1.1.0
dart_auto_logger: ^1.1.0 copied to clipboard
Automatic debug logging for Dart (Appwrite functions). Pure Dart with no Flutter dependencies.
1.1.0 #
-
Documentation: Added INSERT and UPDATE/DELETE SQL metadata JSON examples to parsing guide Section 6 — only SELECT was shown, but
insertId(INSERT) androwsAffected(UPDATE/DELETE) have different metadata shapes -
Fixed:
_getSourceLocation()in zone_config.dart was missingpackage:talker/URI filter — SLOW_CALLBACK sourceLocation could point to a Talker frame instead of user code._extractFiles()and_fingerprint()in the same file already had the filter; now consistent. -
Fixed:
SSL_CERT_REJECTEDlogged vialogger.problem()without structured metadata — host and port were only in the message string. Now includesmetadata: {'host': host, 'port': port}for programmatic parsing. -
Fixed:
GrpcLoggingHelper.onRequest()and.onResponse()calledrequest?.toString()/response?.toString()twice — once for.length, once for the value. gRPC protobuftoString()can be expensive. Now cached in local variable. -
Documentation: Fixed loading monitor timer claim in developer documentation — was incorrectly stating "timers only run while operations are being tracked"; actually runs continuously after
startMonitoring()(lightweight when idle) -
Fixed: Email validation
RegExpwas recreated on everyValidate.email()call — now cached asstatic final(13-15x faster in AOT per Dart SDK #42366) -
Fixed: SQL error logging called
error.toString()twice in message construction — now cached in local variable -
Fixed:
StackTrace.current.toString()was called eagerly on everyloadingMonitor.track()andwithTimeout()invocation — now stores StackTrace as object (cheap) and only stringifies when stuck/timeout event actually fires (loading_monitor.dart, safe_api.dart) -
Fixed:
_getSourceLocation()in logger.dart was missingpackage:talker/URI filter — could report a Talker frame as source location._getSourceLocationFromStack()already had the filter; now consistent. -
Documentation: Added optional
invalidValueparameter toValidate.isTrueexample in developer documentation -
Fixed:
FILE_READ_LINESasync now includesmstiming metadata — was the only async file read operation missing duration measurement (io_overrides.dart) -
Fixed:
FILE_WRITE_BYTESandFILE_WRITE_BYTES_SYNCnow includemodemetadata — writeAsString logged write mode but writeAsBytes did not (io_overrides.dart) -
Documentation: Fixed Hive metadata JSON example in parsing guide — was mixing fields from 3 different events and using
foundwhen HIVE_CONTAINS usesexists; now split into per-event examples -
Documentation: Fixed jq commands in parsing guide — added
sed 's/.*| //'to extract metadata JSON before piping to jq (log lines are not raw JSON) -
Documentation: Updated FILE_READ_LINES metadata in parsing guide to include
msfield -
Documentation: Updated FILE_WRITE_BYTES metadata in parsing guide to include
modefield -
Documentation: Expanded README "What's Logged Automatically" table — added Drift SQL, WebSocket, gRPC, BLoC/Riverpod, Hive, Dio rows with Auto/Semi labels
-
Documentation: Fixed COMPONENT field in parsing guide — marked UI, NAV, LIFECYCLE, MEMORY as Flutter-only with note to use
auto_loggerfor those -
Documentation: Added cross-reference note at top of parsing guide — points to
auto_loggerparsing guide for Flutter-specific events -
Documentation: Added Timer/Periodic metadata JSON examples to parsing guide Section 6 — TIMER_CREATE/FIRE and PERIODIC_CREATE/FIRE metadata fields were documented in text but had no JSON examples
-
Documentation: Condensed AI guide configuration section — reduced verbose multi-line comments to single-line format with defaults
-
Documentation: Completed exception field documentation — added AppException base class shared fields (code, context, originalError, originalStackTrace), ParseException.expectedFormat parameter, and per-exception field summary to developer documentation, AI guide, and README
-
Fixed: Hash function cross-platform inconsistency —
hash &= 0xFFFFFFFFproduced signed 32-bit values on web (JavaScript) but unsigned on native, causing different fingerprints for the same error across platforms. Changed tohash &= 0x3FFFFFFF(30-bit, always positive on all platforms). Affects logger.dart, zone_config.dart, user_trail.dart. -
Fixed: LoadingMonitor.track() same-name collision — concurrent operations with identical names would overwrite each other's tracking entry. Now uses counter-based unique key (same pattern as drift, Dio, and HTTP fixes).
-
Fixed:
initDart()was not callingloadingMonitor.startMonitoring()— stuck operation detection (STUCK_OPERATION events) never activated when usinginitDart()orrunDart(). -
Fixed: WebSocket sink created new LoggingWebSocketSink wrapper on every
.sinkaccess — now lazy-cached for identity consistency and reduced allocations. -
Fixed:
json.encode(metadata)in logger.log() could throw on non-serializable metadata objects. Now wrapped in try-catch with fallback tometadata.toString(). -
Fixed:
getRouteStackandgetStateSnapshotcallback crashes during error logging could lose crash/problem/stuck reports. Now wrapped in try-catch in all metadata collection sites across core files (_getContext(),_checkStuck(),track()finally,_logSlowCallbackIfNotDuplicate(),safe_api.dart,drift_interceptor.dart). -
Documentation: Fixed unverifiable ~80-90ns zone overhead claim in developer documentation — replaced with defensible "negligible overhead" wording citing Sentry, Firebase, and Flutter all using zones in production
-
Documentation: Fixed parsing guide
originalErrormetadata claim for API_FAILED —logger.problem()produceserrorTypeanderrorMessage, notoriginalError(which only exists on the thrownNetworkExceptionobject, not in log metadata) -
Documentation: Fixed Performance Notes section — was claiming
DartAutoLogger.runDart(enabled: false, ...)exists, butrunDart()has noenabledparameter; onlyinitDart(enabled: false)works -
Documentation: Fixed library doc comment in
dart_auto_logger.dart— Appwrite example was showinginitDart()butrunDart()is the recommended approach for full zone-based logging -
Documentation: Added
runWithLogging()andrunWithLoggingAsync()to developer documentation and AI guide — exported public API for running code in a logging zone outsideDartAutoLogger.runDart(), useful for isolated work -
Documentation: Clarified
initDart()vsrunDart()in README —runDart()gives full zone features (timer tracking, slow callbacks, print capture, error catching),initDart()only sets up HTTP/IO overrides -
Documentation: Added note about default
minLevel: WARNfiltering to README — most automatic events are DEBUG level and invisible with default settings, which was not prominently communicated -
Documentation: Added Performance Notes section to developer documentation — documents
enabledparameter, zone callback overhead, and absence of background timers in pure Dart. -
Documentation: Fixed SQL Metadata in parsing guide — field name was
affectedbut code usesrowsAffectedfor UPDATE/DELETE results;argsexample was"[1]"(string) but code produces["1"](list) -
Documentation: Fixed File Metadata sync variant descriptions in parsing guide — _SYNC variants do not include
ms(sync operations are not timed); FILE_WRITE_SYNC also includesmode(was only documented for FILE_WRITE) -
Documentation: Fixed File Metadata example in parsing guide — was showing
"bytes"but string operations (FILE_READ, FILE_WRITE) use"chars", byte operations (FILE_READ_BYTES, FILE_WRITE_BYTES) use"bytes", and line operations (FILE_READ_LINES) use"lines". FILE_WRITE also has undocumented"mode"field. Now shows separate examples per operation variant. -
Documentation: Added Socket Metadata section to parsing guide Section 6 — documents
host/address,port,msfields for SOCKET_CONNECTED, SOCKET_CONNECT_ERROR, SERVER_BIND, SERVER_BOUND, SERVER_BIND_ERROR events (were emitted in code but not documented in metadata reference) -
Fixed: HTTP request tracking collision —
pendingHttpRequestsused'$method $url'as map key, causing concurrent identical requests (e.g., two simultaneousGET https://api.example.com/users) to overwrite each other's tracking entry. Now uses unique counter suffix#${_httpRequestCounter++}(same pattern as drift fix #22 and Dio fix #23) -
Documentation: Added missing file/directory event variants to AI guide —
FILE_READ_BYTES,FILE_WRITE_BYTES,FILE_READ_LINES,LINK_CREATE, and all_SYNCcounterparts (12 file sync + 5 directory sync variants) were in code and parsing guide but missing from AI guide event listings -
Documentation: Fixed
LoggingDioInterceptorcode docstring in integrations.dart — was showingdio.interceptors.add(LoggingDioInterceptor())which would not compile becauseLoggingDioInterceptordoes not extend Dio'sInterceptorclass; now shows correctInterceptorsWrapperpattern matching all user-facing docs. Also adapted "Flutter Web" reference to pure Dart context. -
Documentation: Removed phantom
DIR_TEMPevent from AI guide File/Directory event listings —createTemp/createTempSyncdelegate without logging andDIR_TEMPwas never emitted -
Documentation: Added WebSocket Metadata section to parsing guide Section 6 — documents
url,size,code,reasonfields (WebSocket is a shared core feature, was missing from dart_auto_logger parsing guide while present in auto_logger) -
Added:
fseGetTypeSync()override in IOOverrides — logs FSE_TYPE_SYNC (sync version of existing FSE_TYPE) -
Added: Socket connection logging via IOOverrides — socketConnect (SOCKET_CONNECT_START/SOCKET_CONNECTED/SOCKET_CONNECT_ERROR), socketStartConnect (SOCKET_START_CONNECT), serverSocketBind (SERVER_BIND/SERVER_BOUND/SERVER_BIND_ERROR)
-
Removed:
LoggingSharedPreferencesclass - SharedPreferences is a Flutter-only plugin that cannot work in pure Dart environments (Appwrite functions, CLI apps). Useauto_loggerpackage for Flutter apps that need SharedPreferences logging. -
Documentation: Removed SharedPreferences section from parsing guide (Flutter-only feature)
-
Documentation: Added State Snapshot section to AI guide (
logger.getStateSnapshot,logger.getRouteStack) -
Documentation: Fixed Riverpod integration comment to clarify pure Dart uses
riverpodpackage, notflutter_riverpod -
Added: Configurable gRPC slow threshold via
autoLoggerConfig.grpcSlowThresholdMs(default: 1000ms) - gRPC calls slower than this are logged at WARN level -
Fixed: Email validation regex now supports TLDs longer than 4 characters (e.g., .museum, .technology, .international)
-
Documentation: Added Hive integration example to README
-
Documentation: Clarified Appwrite Realtime comment - it's for monitoring function executions from a long-running Dart app, not from inside serverless functions
-
Documentation: Added User Trail section to AI guide with record(), recordButton(), and getRecentWithHash() examples
-
Documentation: Added Timer/Print events (PRINT, TIMER_CREATE, TIMER_FIRE, PERIODIC_CREATE, PERIODIC_FIRE) to parsing guide
-
Added:
LoadingMonitor.onAllOperationsCompletecallback - invoked whenactiveOperationsbecomes empty, allowing performance monitors to reset state at operation boundaries (matches auto_logger for package consistency) -
Documentation: Added missing
[Flutter only]markers to parsing guide metadata sections (Performance Metadata, Freeze Metadata, SharedPreferences Metadata) and Step 4 Component Analysis -
Documentation: Fixed Step 4 Component Analysis to only show Dart-applicable grep commands (removed UI/Memory which are Flutter-only)
-
Fixed: Race condition in
loadingMonitor.track()when same operation name used concurrently - completion logging now uses captured localopInfovariable instead of re-accessing_activeOperations[operation]!which could be null if removed by concurrent call's finally block -
Fixed: SLOW_CALLBACK now logs once per slow operation instead of multiple times when Dart's async machinery registers callbacks through multiple zone handlers (same fingerprint within 100ms = same operation, skip duplicate)
-
Fixed: STUCK_OPERATION now includes
sourceLocationfield extracted from stored call stack - shows wheretrack()was called (operation origin) instead of where detection happened (internal code) -
Fixed: STUCK_OPERATION completion-time check in
track()finally block - ensures stuck detection logs even when Timer.periodic doesn't fire (web platform limitation, canonical log line pattern) -
Added:
errorTypeanderrorMessagefields to crash/problem metadata - exposes exception class name and full error message for better debugging and compatibility with industry standards (Sentry, Firebase Crashlytics) -
Fixed:
crash()andproblem()methods now useStackTrace.currentas fallback when stackTrace is null - ensures errors fromCompleter.completeErrorwithout stack trace (and similar cases) still have full debugging context includingstack,files, and location-awarefingerprint -
Fixed:
sourceLocationnow extracted from error's stack trace as fallback for zone-caught errors - synchronous errors (null errors, type errors, etc.) caught by the zone now havesourceLocationpopulated from the error's stack trace when the current call stack has no user code -
Fixed: Fingerprint deduplication now uses user code frames instead of raw top 3 frames (which were SDK frames for runtime errors). Two different bugs at different locations no longer get the same fingerprint. Now works correctly on web by also skipping
dart-sdk/andlib/_engine/frames. -
Fixed: CRITICAL performance regression -
StackTrace.current.toString()was called for every callback registration (thousands during startup), causing significant slowdowns. Now deferred: stack object captured at registration (cheap),.toString()only called when slow callback detected (expensive, but rare). -
Documentation: Fixed parsing guide to correctly document SLOW_CALLBACK as having
sourceLocation,fingerprint,stack,filesmetadata (was incorrectly listed as system-detected without sourceLocation) -
Fixed: Unhandled async errors no longer freeze the app in debug mode - zone errors are now logged without propagating to root zone
-
Fixed: Documentation comment in
safe_api.dartincorrectly said "30 seconds" - actual default timeout is 2 minutes -
Documentation: Added
PROXY_CONFIGandSSL_CERT_REJECTEDHTTP events to parsing guide and AI guide -
Documentation: Fixed parsing guide to use correct event type
STUCK_OPERATION(was incorrectly documented asSTUCK) -
Fixed: Recursive stack traces now collapsed with count (e.g.,
recurse (×100)) instead of repeating the same frame hundreds of times -
Added:
stack_tracepackage dependency for improved stack trace formatting -
Fixed: Stack traces now use
Trace.terseto remove framework/SDK noise before logging -
Fixed: Removed duplicate stack trace output from Talker (stack is now only in metadata JSON)
-
Fixed:
_extractFilesnow usesTrace.parse()for cross-platform compatibility and handles native (package:), relative web (packages/), and full web URLs (http://localhost/packages/...) -filesfield now correctly populates on web platform -
Added: SLOW_CALLBACK events now include complete debugging metadata (
sourceLocation,stack,files,fingerprint) - stack trace captured at callback registration time for precise source identification -
Fixed: STUCK_OPERATION now logs once when threshold exceeded instead of repeatedly every 5 seconds - matches industry standard (ANR-WatchDog pattern)
-
Documentation: Clarified configuration examples in developer documentation - added "Override to 1 minute" comments to
defaultTimeoutMsandstuckOperationThresholdMsexamples to distinguish override values (60000ms) from actual defaults (120000ms) -
Documentation: Added CLI/Server Apps section to AI guide showing
DartAutoLogger.initDart()for non-Appwrite use cases -
Documentation: Added Documentation section to README listing all documentation files
-
Fixed:
setupHttpOverrides()re-entrance guard — checksHttpOverrides.current is LoggingHttpOverridesto prevent double-wrapping when called from bothrunDart()andinitDart() -
Documentation: Added missing
stackfield to user-triggered events JSON example in AI guide and metadata bullet list in parsing guide -
Documentation: Fixed PRINT event description in parsing guide — captured output is the log message, timestamp in metadata (was incorrectly described as "message in metadata")
-
Documentation: Added missing
msfield to SLOW_CALLBACK metadata list in parsing guide -
Documentation: Added missing
statusfield to FUNCTION_STDERR JSON example in AI guide -
Widened
talkerdependency from^5.0.0to>=4.0.0 <6.0.0— allows pub to resolve talker 4.x on Dart 3.0-3.3 (talker 5.x transitively requires Dart 3.4+ viawebpackage) -
Widened
web_socket_channeldependency from^3.0.0to>=2.3.0 <4.0.0— allows pub to resolve 2.x on Dart 3.0-3.2 (3.x requires Dart 3.3+) -
Fixed: WebSocket
WS_CONNECTEDwas logged prematurely before actual handshake — now observes.readyFuture to log only after successful connection -
Fixed: WebSocket stream errors now logged as
WS_ERRORevent via.handleError()— previously stream errors (disconnect, protocol error) were silently dropped -
Fixed: Removed dead try/catch around WebSocket
.ready— errors are handled by.catchError()on the Future -
Documentation: Added undocumented event types (INIT, USER_ACTION) to parsing guide
-
Documentation: Added
logger.timeout()andlogger.stuck()methods to developer documentation manual logging section -
Documentation: Fixed COMPONENT field in parsing guide to list all 11 LogComponent enum values (was only showing 6)
-
Fixed: Drift
queryIdcollision — replacedstatement.hashCode ^ args.hashCodewith incrementing_queryCounter++counter.List.hashCodeis identity-based in Dart so concurrent identical queries would collide, and XOR made different queries with matching hashes share the same ID -
Fixed:
LoggingDioInterceptorrequest correlation — replaced fragileoptions.hashCodeidentity-based tracking with incrementing_requestCounter++stored in Dio'soptions.extramap for robust request/response/error matching across interceptor stages -
Documentation: Added UserTrail convenience methods (
recordTap,recordButton,recordScroll,recordInput,recordNavigation) to developer documentation -
Documentation: Explained
loggingDioInterceptoras a pre-configured global instance exported by the package in developer documentation -
Documentation: Fixed
getRouteStackexample in developer documentation for server context — now shows['handler:/api/users', 'middleware:auth']instead of Flutter route stack -
Documentation: Added
DartAutoLogger.initDart()CLI/Server Apps section to README -
Documentation: Added
INITstartup event to AI guide event listings -
Documentation: Added File/Directory events, Timer/Zone events, and Loading events to AI guide event listings (were missing — an AI would not know these automatic events exist)
-
Fixed: WebSocket error events now include
urlin metadata —WS_CONNECT_FAILED,WS_ERROR, andWS_SEND_ERRORwere logging errors without theurlfield that all other WS events include -
Fixed:
FUNCTION_STDERRnow useslogger.problem()instead oflogger.log()— auto-injects 10+ debugging fields (sourceLocation,triggerAction,fingerprint,stack,files, etc.) that were missing from stderr logs -
Documentation: Added integration event listings (WebSocket, gRPC, SQL/Drift, BLoC, Riverpod, Hive, Appwrite, Safe Utilities, User Trail) to AI guide
-
Documentation: Fixed parsing guide TIMER_FIRE and PERIODIC_FIRE metadata descriptions; fixed LOADING_START/COMPLETE metadata descriptions
-
Documentation: Added SQL, gRPC, BLoC/Riverpod, Loading, and Safe Utilities metadata JSON examples to parsing guide Section 6
1.0.3 #
- Fixed: Email validation now supports + character (gmail aliases like user+tag@gmail.com)
- Added: Configurable SQL thresholds via
autoLoggerConfig.sqlSlowQueryThresholdMs(default: 100ms) andautoLoggerConfig.sqlSlowBatchThresholdMs(default: 500ms) - Added: Automatic cleanup of stale pending trackers after 10 minutes (configurable via
autoLoggerConfig.pendingTrackerMaxAgeMs) - prevents memory leaks in long debug sessions
1.0.2 #
- Documentation: Clarified metadata availability in problem types - user-triggered events (crash, problem, timeout, stuck) include
sourceLocation, while system-detected events (SLOW_CALLBACK, FUNCTION_STDERR) include contextual metadata
1.0.1 #
- Fixed static analysis error: Added
basemodifier toLoggingIOOverridesfor Dart 3.x compatibility - Fixed LICENSE file to use correct standard MIT license text
- Added example file for pub.dev documentation requirement
- Updated
talkerdependency to ^5.0.0 - Updated and refined documentation (README, AI guide, developer documentation, parsing guide)
1.0.0 #
- Initial release
- Automatic logging for HTTP, file operations, timers, errors, and print statements
- User trail tracking with hash for deduplication
- Loading monitor with stuck operation detection
- Correlation IDs for request tracing
- 9 custom exception types (NetworkException, ValidationException, NotFoundException, StateException, AppTimeoutException, PermissionException, AuthenticationException, StorageException, ParseException)
- 9 validation utilities (notNull, notEmpty, listNotEmpty, positive, nonNegative, inRange, percentage, email, isTrue)
- Integration helpers for BLoC, Riverpod, Drift SQL, gRPC, WebSocket
- Cross-platform WebSocket logging
- Pure Dart with no Flutter dependencies - ideal for Appwrite functions