auto_logger 1.1.0 copy "auto_logger: ^1.1.0" to clipboard
auto_logger: ^1.1.0 copied to clipboard

Automatic debug logging for Flutter apps. Zero-setup capture of HTTP, platform channels, pointer events, keyboard, navigation, lifecycle, errors, and more.

example/example.dart

import 'package:flutter/material.dart';
import 'package:auto_logger/auto_logger.dart';

void main() {
  // Wrap your app with AutoLogger.run() for automatic logging
  AutoLogger.run(() => const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Auto Logger Example',
      // Add navigator observer for automatic route logging
      navigatorObservers: [AutoLogger.navObserver],
      // Log unknown routes
      onUnknownRoute: AutoLogger.onUnknownRoute,
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> with SafeDisposalMixin {
  late final TextEditingController _controller;

  @override
  void initState() {
    super.initState();
    // Create controller and track for automatic disposal
    _controller = TextEditingController();
    trackTextController(_controller);
  }

  Future<void> _fetchData() async {
    // Use loadingMonitor.track to detect stuck operations
    await loadingMonitor.track('fetchData', () async {
      // HTTP requests are automatically logged
      // Simulating API call
      await Future.delayed(const Duration(seconds: 1));
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Auto Logger Example')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            // Keys enable automatic tap logging in user trail
            TextField(
              key: const Key('EmailInput'),
              controller: _controller,
              decoration: const InputDecoration(labelText: 'Email'),
            ),
            const SizedBox(height: 16),
            ElevatedButton(
              key: const Key('FetchButton'),
              onPressed: _fetchData,
              child: const Text('Fetch Data'),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
160
points
46
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Automatic debug logging for Flutter apps. Zero-setup capture of HTTP, platform channels, pointer events, keyboard, navigation, lifecycle, errors, and more.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

drift, flutter, leak_tracker, meta, stack_trace, talker, uuid, web_socket_channel

More

Packages that depend on auto_logger