Closed vysakhvasanth closed 2 months ago
I've registered the callback in the main.dart
entry point right after the setup call FlutterLogs.initLogs
Same problem here with v2.1.11 on Android, not sure what I'm doing wrong, I run this:
await FlutterLogs.init(...);
Then copy-pasted the channel setup from readme added a log at the very start but it never shows!?
FlutterLogs.channel.setMethodCallHandler((call) async {
logInfo(message: 'Received FlutterLogs callback: ${call.method}');
}
In console I see this, but not the message above:
I/ExportTypes( 4479): getLogsForAllInRoot: Path: /storage/emulated/0/Android/data/com.my.app/files/Logs/, Files: 2
I/PLogger_DEBUG( 4479): Adding directory: /storage/emulated/0/Android/data/com.my.app/files/exported/Temp/21112023/
I/PLogger_DEBUG( 4479): Adding file: /storage/emulated/0/Android/data/com.my.app/files/exported/Temp/21112023/2111202319.log
I/PLogger_DEBUG( 4479): Adding file: /storage/emulated/0/Android/data/com.my.app/files/exported/Temp/21112023/2111202320.log
I/PLogger_DEBUG( 4479): Output Zip: 21112023_200738_PM_all_[2].zip
I also try to use whenComplete or then on the exportLogs() call, it appears that the call never complete:
FlutterLogs.exportLogs(exportType: ExportType.ALL).then((value) {
logInfo(message: 'Finished exporting FlutterLogs...');
});
FlutterLogs.exportLogs(exportType: ExportType.ALL).whenComplete(() {
logInfo(message: 'Finished exporting FlutterLogs...');
});
Will try on iOS asap.
@vysakhvasanth Did you find a solution?
Ended-up using flutter_archive to export logs into a ZIP file:
Directory dir = Directory("${externalDirectory.path}/Logs");
final zipFile = File("${externalDirectory.path}/Logs_${DateFormat('yyyy-MM-dd_HH-mm').format(DateTime.now())}.zip");
await ZipFile.createFromDirectory(sourceDir: dir, zipFile: zipFile, recurseSubDirs: true);
logInfo(message: "Logs zipped into ${zipFile.path}");
@ced1check what did you end up with?
I'm using the latest version 2.1.10.
When I export the logs, I'm trying to capture the callback to upload file to a server. But the callback registered is not getting hit.