resultex_logger 1.3.5 copy "resultex_logger: ^1.3.5" to clipboard
resultex_logger: ^1.3.5 copied to clipboard

A lightweight, high-performance, and colorized logging system for Flutter and Dart built on top of native developer.log

Resultex Logger #

A lightweight, powerful, and highly compatible logging system for Dart and Flutter. Built directly on top of native developer.log, it ensures seamless **cross-platform, Web, and WASM compatibility ** without breaking a sweat or relying on heavy external dependencies.

pub package License: MIT


Features #

  • ✅ Color Logs: High-visibility ANSI escape sequences to colorize your terminal.
  • ✅ Comprehensive LogLevels: Full support for info, verbose, warning, debug, error, critical, fine, and good.
  • ✅ Logs Grouping (In Progress): Visual nesting for hierarchical runtime operations.
  • ✅ Collapsible Huge Logs (In Progress): Smart multi-line layout to handle massive payloads and stack traces cleanly.

Preview #

Resultex Standard Logs Resultex Error Logs

---

Getting Started #

Installation #

Since this package is tailored for internal/monorepo architectural designs, add it to your pubspec.yaml using a local path:

dependencies:
  resultex_logger: ^1.3.5

Initialize Dependencies #

Before using the logger, initialize its dependency injection layer. It is highly recommended to do this in your main.dart before runApp:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize the logger base configuration
  final loggerBase = ResultexLoggerBase();
  // Initialize and register the global ResultexLogger instance into GetIt.
  GetIt.I.registerResultexLogger(
    settings: ResultexLoggerSettings(
      minLogLevel: LogLevel.debug,
      enableColors: true,
    ),
  );

  await loggerBase.init();

  runApp(const MyApp());
}

Basic Usage & Log Mapping #

Import the main entry point and start logging across your application. The logger automatically maps colors, tags, and Syslog levels internally:

import 'package:resultex_logger/logger.dart';

void main() {
  // Initialize the logger base configuration
  final loggerBase = ResultexLoggerBase();
  // Initialize the concrete instance of AppLogger.
  final logger = ResultexLogger(
    settings: ResultexLoggerSettings(
      maxLineWidth: 40, // Slimmer boxes
      lineSymbol: '*', // Use hashes instead of solid lines
    ),
  );
  // Or you can get the logger from get_it di
  final logger = GetIt.get<LoggerService>;

  await loggerBase.init();
  // Standard Logs 
  logger.debug('Database connection established.');
  logger.info('Resource allocated smoothly.');

  // Warnings & Debugs
  logger.warning('API response time is slower than expected.');
  logger.debug('Fetching user data dynamic payload...');

  // Errors & Critical Crashes
  try {
    throw Exception('Connection timed out');
  } catch (e, stack) {
    logger.error('Failed to load dashboard data', error: e, stackTrace: stack);
    logger.critical(
        'Fatal: System is unable to recover from this state!', error: e, stackTrace: stack);
  }
}

Architecture Note #

This package adheres strictly to the Single Responsibility Principle. The AppLogger is decoupled from initialization lifecycles, preventing circular dependencies and making it extremely easy to mock during Unit Testing.

📄 License #

This project is licensed under the MIT License - see the LICENSE file for details. Open Source development is respected; feel free to modify, distribute, and implement this package in both public repositories and enterprise closed-source commercial systems.

3
likes
160
points
520
downloads

Documentation

API reference

Publisher

verified publishercodearastudio.ir

Weekly Downloads

A lightweight, high-performance, and colorized logging system for Flutter and Dart built on top of native developer.log

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

ansicolor, flutter, get_it

More

Packages that depend on resultex_logger