easy_dash_logger 2.0.0 copy "easy_dash_logger: ^2.0.0" to clipboard
easy_dash_logger: ^2.0.0 copied to clipboard

Colored, named logging for Dart and Flutter, silent in release builds by default and configurable per build mode.

example/main.dart

import 'package:easy_dash_logger/easy_dash_logger.dart';

void main() {
  // Logs are shown in debug builds only by default — profile and release
  // builds stay silent. Configure before anything else runs, e.g. before
  // runApp().
  EasyDashLoggerConfig.configure(
    defaultName: 'CUSTOM_LOG',
  );

  // Log different levels of messages
  'This is a debug message'.printLog(color: ANSICOLOR.green);
  'This is an info message'.printLog(color: ANSICOLOR.blue);
  'This is a warning message'.printLog(color: ANSICOLOR.yellow);
  'This is an error message'.printLog(color: ANSICOLOR.red);

  // Example usage of the ColoredLog extension
  'This is a colored log message'.printLog(
    name: 'CUSTOM_LOG',
    color: ANSICOLOR.green,
    bgColor: ANSICOLOR.white,
  );

  // Opt in to logs in a shipped app — e.g. behind a QA or support switch.
  EasyDashLoggerConfig.configure(showLogsInRelease: true);
  'Visible even in a release build'.printLog(color: ANSICOLOR.cyan);

  // Mute everything at runtime, in every build mode.
  EasyDashLoggerConfig.silenceAll();
  'Never printed'.printLog();

  // Route logs somewhere else instead of the console.
  EasyDashLoggerConfig.configure(
    showLogsInDebug: true,
    useColors: false,
    output: (message, name) {
      // send to a file, Crashlytics, a test spy, ...
    },
  );
  'This goes to the custom sink'.printLog();
}
2
likes
160
points
44
downloads

Documentation

API reference

Publisher

verified publishermreslam.net

Weekly Downloads

Colored, named logging for Dart and Flutter, silent in release builds by default and configurable per build mode.

Repository (GitHub)
View/report issues

Topics

#logging #debugging #console

License

MIT (license)

More

Packages that depend on easy_dash_logger