Skip to main content

dart_auto_logger 1.1.0 copy "dart_auto_logger: ^1.1.0" to clipboard
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) and rowsAffected (UPDATE/DELETE) have different metadata shapes

  • Fixed: _getSourceLocation() in zone_config.dart was missing package: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_REJECTED logged via logger.problem() without structured metadata — host and port were only in the message string. Now includes metadata: {'host': host, 'port': port} for programmatic parsing.

  • Fixed: GrpcLoggingHelper.onRequest() and .onResponse() called request?.toString() / response?.toString() twice — once for .length, once for the value. gRPC protobuf toString() 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 RegExp was recreated on every Validate.email() call — now cached as static 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 every loadingMonitor.track() and withTimeout() 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 missing package:talker/ URI filter — could report a Talker frame as source location. _getSourceLocationFromStack() already had the filter; now consistent.

  • Documentation: Added optional invalidValue parameter to Validate.isTrue example in developer documentation

  • Fixed: FILE_READ_LINES async now includes ms timing metadata — was the only async file read operation missing duration measurement (io_overrides.dart)

  • Fixed: FILE_WRITE_BYTES and FILE_WRITE_BYTES_SYNC now include mode metadata — 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 found when HIVE_CONTAINS uses exists; 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 ms field

  • Documentation: Updated FILE_WRITE_BYTES metadata in parsing guide to include mode field

  • 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_logger for those

  • Documentation: Added cross-reference note at top of parsing guide — points to auto_logger parsing 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 &= 0xFFFFFFFF produced signed 32-bit values on web (JavaScript) but unsigned on native, causing different fingerprints for the same error across platforms. Changed to hash &= 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 calling loadingMonitor.startMonitoring() — stuck operation detection (STUCK_OPERATION events) never activated when using initDart() or runDart().

  • Fixed: WebSocket sink created new LoggingWebSocketSink wrapper on every .sink access — 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 to metadata.toString().

  • Fixed: getRouteStack and getStateSnapshot callback 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 originalError metadata claim for API_FAILED — logger.problem() produces errorType and errorMessage, not originalError (which only exists on the thrown NetworkException object, not in log metadata)

  • Documentation: Fixed Performance Notes section — was claiming DartAutoLogger.runDart(enabled: false, ...) exists, but runDart() has no enabled parameter; only initDart(enabled: false) works

  • Documentation: Fixed library doc comment in dart_auto_logger.dart — Appwrite example was showing initDart() but runDart() is the recommended approach for full zone-based logging

  • Documentation: Added runWithLogging() and runWithLoggingAsync() to developer documentation and AI guide — exported public API for running code in a logging zone outside DartAutoLogger.runDart(), useful for isolated work

  • Documentation: Clarified initDart() vs runDart() 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: WARN filtering 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 enabled parameter, zone callback overhead, and absence of background timers in pure Dart.

  • Documentation: Fixed SQL Metadata in parsing guide — field name was affected but code uses rowsAffected for UPDATE/DELETE results; args example 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 includes mode (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, ms fields 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 — pendingHttpRequests used '$method $url' as map key, causing concurrent identical requests (e.g., two simultaneous GET 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 _SYNC counterparts (12 file sync + 5 directory sync variants) were in code and parsing guide but missing from AI guide event listings

  • Documentation: Fixed LoggingDioInterceptor code docstring in integrations.dart — was showing dio.interceptors.add(LoggingDioInterceptor()) which would not compile because LoggingDioInterceptor does not extend Dio's Interceptor class; now shows correct InterceptorsWrapper pattern matching all user-facing docs. Also adapted "Flutter Web" reference to pure Dart context.

  • Documentation: Removed phantom DIR_TEMP event from AI guide File/Directory event listings — createTemp/createTempSync delegate without logging and DIR_TEMP was never emitted

  • Documentation: Added WebSocket Metadata section to parsing guide Section 6 — documents url, size, code, reason fields (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: LoggingSharedPreferences class - SharedPreferences is a Flutter-only plugin that cannot work in pure Dart environments (Appwrite functions, CLI apps). Use auto_logger package 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 riverpod package, not flutter_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.onAllOperationsComplete callback - invoked when activeOperations becomes 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 local opInfo variable 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 sourceLocation field extracted from stored call stack - shows where track() 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: errorType and errorMessage fields 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() and problem() methods now use StackTrace.current as fallback when stackTrace is null - ensures errors from Completer.completeError without stack trace (and similar cases) still have full debugging context including stack, files, and location-aware fingerprint

  • Fixed: sourceLocation now extracted from error's stack trace as fallback for zone-caught errors - synchronous errors (null errors, type errors, etc.) caught by the zone now have sourceLocation populated 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/ and lib/_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, files metadata (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.dart incorrectly said "30 seconds" - actual default timeout is 2 minutes

  • Documentation: Added PROXY_CONFIG and SSL_CERT_REJECTED HTTP events to parsing guide and AI guide

  • Documentation: Fixed parsing guide to use correct event type STUCK_OPERATION (was incorrectly documented as STUCK)

  • Fixed: Recursive stack traces now collapsed with count (e.g., recurse (×100)) instead of repeating the same frame hundreds of times

  • Added: stack_trace package dependency for improved stack trace formatting

  • Fixed: Stack traces now use Trace.terse to remove framework/SDK noise before logging

  • Fixed: Removed duplicate stack trace output from Talker (stack is now only in metadata JSON)

  • Fixed: _extractFiles now uses Trace.parse() for cross-platform compatibility and handles native (package:), relative web (packages/), and full web URLs (http://localhost/packages/...) - files field 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 defaultTimeoutMs and stuckOperationThresholdMs examples 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 — checks HttpOverrides.current is LoggingHttpOverrides to prevent double-wrapping when called from both runDart() and initDart()

  • Documentation: Added missing stack field 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 ms field to SLOW_CALLBACK metadata list in parsing guide

  • Documentation: Added missing status field to FUNCTION_STDERR JSON example in AI guide

  • Widened talker dependency from ^5.0.0 to >=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+ via web package)

  • Widened web_socket_channel dependency from ^3.0.0 to >=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_CONNECTED was logged prematurely before actual handshake — now observes .ready Future to log only after successful connection

  • Fixed: WebSocket stream errors now logged as WS_ERROR event 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() and logger.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 queryId collision — replaced statement.hashCode ^ args.hashCode with incrementing _queryCounter++ counter. List.hashCode is identity-based in Dart so concurrent identical queries would collide, and XOR made different queries with matching hashes share the same ID

  • Fixed: LoggingDioInterceptor request correlation — replaced fragile options.hashCode identity-based tracking with incrementing _requestCounter++ stored in Dio's options.extra map for robust request/response/error matching across interceptor stages

  • Documentation: Added UserTrail convenience methods (recordTap, recordButton, recordScroll, recordInput, recordNavigation) to developer documentation

  • Documentation: Explained loggingDioInterceptor as a pre-configured global instance exported by the package in developer documentation

  • Documentation: Fixed getRouteStack example 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 INIT startup 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 url in metadata — WS_CONNECT_FAILED, WS_ERROR, and WS_SEND_ERROR were logging errors without the url field that all other WS events include

  • Fixed: FUNCTION_STDERR now uses logger.problem() instead of logger.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) and autoLoggerConfig.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 base modifier to LoggingIOOverrides for Dart 3.x compatibility
  • Fixed LICENSE file to use correct standard MIT license text
  • Added example file for pub.dev documentation requirement
  • Updated talker dependency 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
0
likes
160
points
75
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Automatic debug logging for Dart (Appwrite functions). Pure Dart with no Flutter dependencies.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

drift, meta, stack_trace, talker, uuid, web_socket_channel

More

Packages that depend on dart_auto_logger