QLogger.createOutputToFile constructor

QLogger.createOutputToFile(
  1. String? name, {
  2. String? filePath,
})

Implementation

factory QLogger.createOutputToFile(String? name, {String? filePath}) {
  var logger = QLogger(name ?? 'Log', filePath);
  var fOutput = FileOutput(file: File(logger.filePath!));
  fOutput.init();
  var w = LogStreamWriter();
  Logger.writer = w;
  w.messages.listen((LogMessage message) {
    fOutput.output('${message.timestamp} | ${message.message}');
  });
  return logger;
}