fp_logger 3.2.0
fp_logger: ^3.2.0 copied to clipboard
A simple logger for flutter and dart projects. It supports logging to console with formatted messages and stacktrace.
Changelog #
3.2.0 - 2026-11-29 #
Fixed #
- Redaction now actually reaches network logs -
DioLogger,GraphqlDioLoggerandLoggerLinkwere JSON-encoding bodies/headers into strings before handing them toLogger, which only redactsMap/Listinput, so sensitive fields were previously logged in clear text. They now redact the structured data first. - Fixed the same redaction bypass for
Logger.d/i/w/e/s/rawwhen passed a lazyFunctionmessage or a JSON-encoded string message - redaction now runs after they're evaluated/decoded, not before. - Fixed
LoggerLinkmutating the live outgoing request's headers map whenauthHeaderis disabled - it previously calledremoveWhereon the actual map sent over the wire instead of a copy. Redactorhardening: added missingtoken/cookiekeys, switched from exact-only key matching to a word-boundary match so variants likenewPassword,confirm_password, and prefixed headers likeX-Api-Key/X-Access-Tokenare caught (without false-positiving on keys likeshippingAddress), and fixed it leaking raw nested data once the recursion depth limit was exceeded.DioLoggerandGraphqlDioLoggerno longer share the sameRequestOptions.extrakey for request timing, so attaching both to oneDioinstance no longer makes their durations collide.GraphqlDioLogger.onRequestno longer silently skips logging (and timing) for a non-Mapbody, e.g.FormDatafor a file upload or a batched request.- Auth header stripping in
DioLogger/GraphqlDioLoggeris now case-insensitive, matchingLoggerLink. - Fixed
decode's JSON-detection regex so a multi-line (pretty-printed) JSON string is recognized and decoded. - Removed unreachable dead code in
formatStackTrace.
Added #
LoggerOptions.maxBodyLength- caps how many characters of a request/response body are logged before truncating, andLoggerOptions.copyWith.Logger.enabled- a global flag to silence all logging without swappingdebugPrint.
Changed #
Redactor.redactnow returns the originalMap/Listunchanged (no copy) at every level where nothing needed redaction, instead of always allocating a parallel tree of new collections.- Reduced repeated allocations in the box-drawing output lines and
_splitLineByWidth. - Collapsed the duplicated
DioExceptionTypeswitch in both Dio loggers' error logging, and merged near-identical exception handlers/try-catch wrappers inLoggerLink. - Dropped the
dart:ioimport fromDioLogger,GraphqlDioLoggerandLoggerLink(only used for the'authorization'header name). - Removed the unused
equatabledependency.
3.1.6 - 2026-09-17 #
- Cached
AnsiPenper log level instead of allocating a new one for every output line, reducing allocations for boxed multi-line messages - Fixed a broken JSON-array-detection regex in
decodeso JSON array strings are pretty-printed like objects already were - Switched console output to
debugPrintinstead ofprintto avoid Android logcat dropping/truncating bursty log output - Updated dependencies:
dioto^5.11.1,equatableto^3.0.0, andlintsto^6.1.0
3.1.5(2026-08-18) #
- migrate to OIDC for the publishing
3.1.4 - 2026-08-18 #
- Updated dependencies:
dioto^5.11.0,equatableto^2.1.0, andwebto^1.1.1 - Added support for
DioExceptionType.transformTimeoutinDioLoggerandGraphqlDioLogger - Updated web printer conditional export to use
dart.library.js_interopfor WASM and modern web support - Added comprehensive unit test suite
3.1.3 - 2026-04-06 #
- Enhanced JSON decoding in decode method
3.1.2 - 2026-04-06 #
- handle exceptions in stringify method to prevent crashes
3.1.1 - 2026-01-28 #
- Fixed issue with LoggerLink not logging Query and Mutation operations properly
3.1.0 - 2026-01-28 #
- Added
LoggerOptionsclass to configure default logger settings - Removed separate options from
DioLoggerandGraphqlDioLogger - Updated LoggerLink to log Query and Mutation operations
3.0.1 - 2026-01-25 #
- Export LoggerLink
- Minor fixes and improvements
- Enabled error,warning and info logs in release mode
3.0.0 - 2026-01-24 #
-
All loggers now pass
redactparameter toLoggermethodsLoggerhandles redaction internally via_redactMessage()and_redactError() -
Removed
DioLoggerOptionsclass - All properties now available directly inDioLoggerandGraphqlDioLoggerclasses -
Disabled logging in release mode by default -
kReleaseModecheck inLogger._log()
New Features #
-
LoggerLink
- Introduced
LoggerLinkfor GraphQL logging with redaction support for non DioLink usage
- Introduced
-
Global redaction control
Logger.globalRedact- Enable/disable redaction globally- Per-call
redactparameter overrides global setting
-
Redaction API on Logger
Logger.addSensitiveKeys()- Add custom sensitive keysLogger.removeSensitiveKeys()- Remove keys from sensitive setLogger.isSensitiveKey()- Check if a key is sensitiveLogger.redactData()- Manually redact data
-
New Logger methods
Logger.raw()- Log without box formattingLogger.json()- Pretty print JSON with redaction
-
All log methods support redaction
Logger.d(),Logger.i(),Logger.w(),Logger.e(),Logger.s()Logger.boxed()- Boxed logs with redaction
Improvements #
- Simplified time formatting - Changed to
yyyy-mm-dd hh:mm:ss AM/PM time zoneformat - Better DioException handling - Switch on
DioExceptionTypefor specific error messages - Improved byte formatting - Shows total byte count, limits chunks displayed
- JSON string parsing - Attempts to parse JSON strings in responses
- Consistent tag format -
Dio | Request,Dio | Response,GraphQL | Request, etc. - Cleaner code - Single responsibility, redaction centralized in
Logger
2.0.0 #
Breaking changes:
- removed DioLoggerOptions class and all properties are now available directly in DioLogger and GraphQLDioLogger classes
- disable logging in release mode by default
- improved logging output
1.0.10 #
1.0.9 #
1.0.8 #
- improved dio and graphql logger
1.0.7 #
1.0.6 #
1.0.5 #
- improved logging output
- added
GraphQLDioLogger
1.0.4 #
- add support for web
1.0.3 #
- improved logging output
1.0.2 #
- improved logging output
- updated dependencies
1.0.1 #
1.0.0 #
- initial release.