mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Flush logs before sharing
This commit is contained in:
parent
7b21f85613
commit
ef11dd0f16
@ -67,6 +67,12 @@ public abstract class Logging {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setImmediateFlush(final boolean immediateFlush) {
|
||||
if (fileLogger != null) {
|
||||
fileLogger.setImmediateFlush(true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFileLoggerInitialized() {
|
||||
return logDirectory != null;
|
||||
}
|
||||
|
@ -947,6 +947,11 @@ public class DebugActivity extends AbstractGBActivity {
|
||||
private void shareLog() {
|
||||
String fileName = GBApplication.getLogPath();
|
||||
if (fileName != null && fileName.length() > 0) {
|
||||
// Flush the logs, so that we ensure latest lines are also there
|
||||
GBApplication.getLogging().setImmediateFlush(true);
|
||||
LOG.debug("Flushing logs before sharing");
|
||||
GBApplication.getLogging().setImmediateFlush(false);
|
||||
|
||||
File logFile = new File(fileName);
|
||||
if (!logFile.exists()) {
|
||||
GB.toast("File does not exist", Toast.LENGTH_LONG, GB.INFO);
|
||||
|
Loading…
Reference in New Issue
Block a user