Search packages, repositories and app categories

Package detailsv1.11.0

simple_logger

Provides super simple APIs for logging. The log also includes caller info by setting includeCallerInfo to true. On Android Studio, jump to called location by clicking the log.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
12.5K
Likes
100
Pub points
160

Install package

flutter pub add simple_logger

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Simple_logger is a lightweight Flutter/Dart package that offers straightforward logging functionality with minimal setup. It supports detailed log output, including caller information when enabled, which helps trace where logs originate. On Android Studio, developers can jump directly to the source location by clicking on the log entry. The package works across all major platforms—Android, iOS, Web, macOS, Windows, and Linux—making it ideal for consistent debugging in multi-platform applications. Its simplicity and integration with development tools enhance productivity during app development and troubleshooting.

Use cases

  • Debugging application flow
  • Tracking runtime errors
  • Monitoring state changes
  • Cross-platform logging
  • Quick integration into existing projects

Key features

  • Minimal API surface
  • Caller info inclusion
  • IDE navigation support
  • Multi-platform compatibility
  • Easy setup
  • Formatted log output

Suitable for

  • Beginner developers
  • Rapid prototyping
  • Team debugging workflows
  • Small to medium-sized apps
  • Development environments

Considerations

  • Not suitable for production-level structured logging
  • Limited customization options
  • No log level filtering by default
  • Does not support external log storage
  • No built-in log rotation or persistence

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

simple_logger

Provides super simple APIs for logging. The log also includes caller info by setting includeCallerInfo to true. On Android Studio, jump to caller info by clicking the log.

Usage

// Singleton (factory)
final logger = SimpleLogger();

// Printed without called location
logger.info('Hello info!');
// -> 👻 INFO  2018-12-16 21:46:20.092695 [caller info not available] Hello info!

// Printed function which returns object
logger.info(() => 'Hello info!');
// -> 👻 INFO  2018-12-16 21:46:20.092695 [caller info not available] Hello info!

logger.setLevel(Level.WARNING);

// Not printed
logger.info('Hello info!');

// Printed
logger.warning('Hello warning!');
// -> ⚠️ WARNING  2018-12-16 21:46:20.101114 [caller info not available] Hello warning!

logger.shout('Hello shout!');
// -> 😡 SHOUT  2018-12-16 21:46:20.101308 [caller info not available] Hello shout!

logger.setLevel(
  Level.INFO,
  // Includes  caller info, but this is expensive.
  includeCallerInfo: true,
);

// Printed with called location
logger.info('Hello info!');
// -> 👻 INFO  2018-12-16 21:50:03.562583 [example/simple_logger_example.dart 29:10 in main] Hello info!

// Customize level prefix
logger.levelPrefixes = {};
logger.info('Hello info!');
// -> INFO  2018-12-16 21:50:03.562583 [example/simple_logger_example.dart 29:10 in main] Hello info!

logger.formatter = (info) => 'Customized output: (${info.message})';
logger.info('Hello info!');
// -> Customized output: (Hello info!)

logger.onLogged = (info) => print('Insert your logic with $info');
logger.info('Hello info!');
// -> Customized output: (Hello info!)
// -> Insert your logic with Instance of 'LogInfo'

Technical Articles

Features and bugs

Please file feature requests and bugs at the issue tracker.

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package