file_logging 1.0.0 copy "file_logging: ^1.0.0" to clipboard
file_logging: ^1.0.0 copied to clipboard

simple extension on `logging` package to handle logging into files using isolates (this is not supported in web)

example/file_logging_example.dart

import 'package:file_logging/file_logging.dart';
import 'package:file_logging/src/file_manager/file_command.dart';
import 'package:logging/logging.dart';

void main() async {
  final fLogger = FileLogger.init(
    Logger.root,
    filePathGetter: (logger) => '$logger.log',
    fileEventListener: (FileCommandResponse response) {
      print(response);
      if (response.data != null) {
        print(String.fromCharCodes(response.data!));
      }
    },
  );
  final logger = Logger('temp');
  await fLogger.initFileIsolateForAttachedLoggers();
  // fLogger.readAll();
  for (int i = 0; i <= 100; i++) {
    logger.info('Log no.$i');
    Future.delayed(const Duration(milliseconds: 20));
  }
  fLogger.readAll();
  // fLogger.terminateAllIsolates();
}
0
likes
150
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

simple extension on `logging` package to handle logging into files using isolates (this is not supported in web)

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

logging, meta

More

Packages that depend on file_logging