flutter_file_logger

A Flutter plugin to log messages to files.

Features

  • Log messages to files with different log levels (info, warning, error, etc.)
  • Configurable log file location and retention policy
  • Supports both Android and iOS
  • Easy integration and usage

Installation

Add the following to your pubspec.yaml:

dependencies:
    flutter_file_logger: latest

Then run:

flutter pub get

Usage

import 'package:flutter_file_logger/flutter_file_logger.dart';

void main() async {
    await FlutterFileLogger.open();
    FlutterFileLogger.d('App started');
}

Configuration

You can customize the logger:

final config = LogConfig(
    saveDirPath: 'saveDirPath',
    maxCacheDays: 7,
    fileNamePrefix: 'flutter_file_log',
    publicKey: 'publicKey',
);
FlutterFileLogger.open(config);

License

MIT License. See LICENSE for details.