Flogs icon indicating copy to clipboard operation
Flogs copied to clipboard

How can I get the zip of log files to send to our Development team?

Open bigbang489 opened this issue 4 years ago • 4 comments

bigbang489 avatar Mar 17 '20 01:03 bigbang489

Hi @bigbang489 Flog is designed using a database to help extract logs based on different filters, so instead of sending a file to the server why not getting filters from the server (e.g. today, error logs, etc) and send logs via API call. This way you can reduce the logs because you already filtered out the un-necessary logs.

However, I will make sure export logs should return the file path. But for now, you can use the code below:

//local storage
static final LogsStorage _storage = LogsStorage.instance;

//get all logs and write to file
  getAllLogs().then((logs) {
    logs.forEach((log) {
      buffer.write(Formatter.format(log, _config));
    });

    _storage.writeLogsToFile(buffer.toString());
    print(buffer.toString());
    buffer.clear();
  });

zubairehman avatar Mar 17 '20 04:03 zubairehman

I manually exported the logs to a file using exportLogs() and compressed it. But, await was missing in the exportLogs(), So manually replicated the exportLogs function using await by referring to above post and compressed it.

Ajaystefin avatar Apr 14 '20 04:04 Ajaystefin

@Ajaystefin the easier approach would be to fetch all the logs by using getAllLogs() and either send them directly to the server in the form of JSON or write them into the file and send a zip file. However, I am planning to add this functionality soon into Flogs :)

Stay tuned!

zubairehman avatar Apr 14 '20 09:04 zubairehman

Awesome! thanks.

Ajaystefin avatar Apr 14 '20 09:04 Ajaystefin