Skip to main content

fp_logger 3.2.2 copy "fp_logger: ^3.2.2" to clipboard
fp_logger: ^3.2.2 copied to clipboard

A simple logger for flutter and dart projects. It supports logging to console with formatted messages and stacktrace.

Changelog #

3.2.2 - 2026-11-29 #

  • Updated the README's install snippet to ^3.2.1 to match the current release

3.2.1 - 2026-11-29 #

  • Rewrote the README with a proper feature list, install snippet and usage examples for Logger, DioLogger, GraphqlDioLogger, LoggerLink and LoggerOptions (including the new maxBodyLength and copyWith)
  • Excluded example/ from the root analysis_options.yaml - flutter analyze run from the repo root was picking up the example app's files, which made the publish workflow's analyze step fail once a newer Flutter stable release started flagging package:flutter/material.dart as deprecated

3.2.0 - 2026-11-29 #

Fixed #

  • Redaction now actually reaches network logs - DioLogger, GraphqlDioLogger and LoggerLink were JSON-encoding bodies/headers into strings before handing them to Logger, which only redacts Map/List input, 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/raw when passed a lazy Function message or a JSON-encoded string message - redaction now runs after they're evaluated/decoded, not before.
  • Fixed LoggerLink mutating the live outgoing request's headers map when authHeader is disabled - it previously called removeWhere on the actual map sent over the wire instead of a copy.
  • Redactor hardening: added missing token/cookie keys, switched from exact-only key matching to a word-boundary match so variants like newPassword, confirm_password, and prefixed headers like X-Api-Key/X-Access-Token are caught (without false-positiving on keys like shippingAddress), and fixed it leaking raw nested data once the recursion depth limit was exceeded.
  • DioLogger and GraphqlDioLogger no longer share the same RequestOptions.extra key for request timing, so attaching both to one Dio instance no longer makes their durations collide.
  • GraphqlDioLogger.onRequest no longer silently skips logging (and timing) for a non-Map body, e.g. FormData for a file upload or a batched request.
  • Auth header stripping in DioLogger/GraphqlDioLogger is now case-insensitive, matching LoggerLink.
  • 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, and LoggerOptions.copyWith.
  • Logger.enabled - a global flag to silence all logging without swapping debugPrint.

Changed #

  • Redactor.redact now returns the original Map/List unchanged (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 DioExceptionType switch in both Dio loggers' error logging, and merged near-identical exception handlers/try-catch wrappers in LoggerLink.
  • Dropped the dart:io import from DioLogger, GraphqlDioLogger and LoggerLink (only used for the 'authorization' header name).
  • Removed the unused equatable dependency.

3.1.6 - 2026-09-17 #

  • Cached AnsiPen per 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 decode so JSON array strings are pretty-printed like objects already were
  • Switched console output to debugPrint instead of print to avoid Android logcat dropping/truncating bursty log output
  • Updated dependencies: dio to ^5.11.1, equatable to ^3.0.0, and lints to ^6.1.0

3.1.5(2026-08-18) #

  • migrate to OIDC for the publishing

3.1.4 - 2026-08-18 #

  • Updated dependencies: dio to ^5.11.0, equatable to ^2.1.0, and web to ^1.1.1
  • Added support for DioExceptionType.transformTimeout in DioLogger and GraphqlDioLogger
  • Updated web printer conditional export to use dart.library.js_interop for 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 LoggerOptions class to configure default logger settings
  • Removed separate options from DioLogger and GraphqlDioLogger
  • 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 redact parameter to Logger methods Logger handles redaction internally via _redactMessage() and _redactError()

  • Removed DioLoggerOptions class - All properties now available directly in DioLogger and GraphqlDioLogger classes

  • Disabled logging in release mode by default - kReleaseMode check in Logger._log()

New Features #

  • LoggerLink

    • Introduced LoggerLink for GraphQL logging with redaction support for non DioLink usage
  • Global redaction control

    • Logger.globalRedact - Enable/disable redaction globally
    • Per-call redact parameter overrides global setting
  • Redaction API on Logger

    • Logger.addSensitiveKeys() - Add custom sensitive keys
    • Logger.removeSensitiveKeys() - Remove keys from sensitive set
    • Logger.isSensitiveKey() - Check if a key is sensitive
    • Logger.redactData() - Manually redact data
  • New Logger methods

    • Logger.raw() - Log without box formatting
    • Logger.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 zone format
  • Better DioException handling - Switch on DioExceptionType for 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.
1
likes
160
points
384
downloads

Documentation

API reference

Publisher

verified publisherkishormainali.com

Weekly Downloads

A simple logger for flutter and dart projects. It supports logging to console with formatted messages and stacktrace.

Homepage
Repository (GitHub)
View/report issues

Topics

#logging #flutter #dart

License

MIT (license)

Dependencies

ansicolor, dio, flutter, gql, gql_exec, gql_link, web

More

Packages that depend on fp_logger