cocomon

Flutter

Add in-app log history, open the viewer screen, and connect the same records to DevTools.

Flutter

comon_logger_flutter adds two major pieces to the ecosystem:

  • HistoryLogHandler for in-memory storage
  • ComonLoggerScreen for browsing those records inside the app

Minimal setup

import 'package:comon_logger/comon_logger.dart';
import 'package:comon_logger_flutter/comon_logger_flutter.dart';

final historyHandler = HistoryLogHandler(maxHistory: 2000);

void initLogging() {
  Logger.root.addHandler(ConsoleLogHandler());
  Logger.root.addHandler(historyHandler);
}

Open the screen like any other Flutter page:

Navigator.push(
  context,
  MaterialPageRoute(
    builder: (_) => ComonLoggerScreen(handler: historyHandler),
  ),
);

What the screen gives you

  • newest-first log list
  • search by message, logger name, and error text
  • filter chips for level, layer, and type
  • expandable details for stack trace and extra
  • custom actions and renderers

DevTools bridge

ComonLoggerServiceExtension(historyHandler).register();

That lets a DevTools extension consume the same stored records.

On this page