Skip to content
pubscout

surf_logger

2.0.2, released 3 years ago by surf.ru

Production-level logger utility for Dart and Flutter with strategy-based configuration.

WASM-ready
$ flutter pub add surf_logger
Source repository

What it does

Surf Logger provides a tool to configure logging within your application using custom log strategies. It separates configuration methods from usage methods via the LogWriter interface to prevent accidental changes during injection.

AI-written summary of version 2.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to route logs to different destinations (console, files, Firebase, Sentry) based on app flavors or environments.
  • You want to separate logger configuration from the interface used for writing logs.

Skip it when

  • You want an out-of-the-box logger with built-in pretty console formatting without writing custom strategies.

Strengths

  • Strategy pattern makes it flexible to send logs to any backend or storage.
  • Not a singleton starting from version 2.0.0, which helps with testing and multiple scopes.
  • Separates logger configuration from the LogWriter interface.

Weaknesses

  • Requires writing custom strategies for specific logging destinations.
  • Dependency on external loggers has been removed, meaning you must define how logging is handled.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add surf_logger to dependencies and configure log strategies.

LogWriter setupLogger() {
  return Logger.withStrategies({
    ConsoleLogStrategy(),
    FirebaseLogStrategy(),
  });
}

Alternatives

Packages that do the same job and could replace surf_logger.

  • logger

    Provides a robust, out-of-the-box pretty printer for console logs.

  • talker_logger

    Offers advanced logging capabilities with customizable settings and filters.

Works with

Packages commonly used together with surf_logger: ones it builds on, ones built on it, and its own family.