diff options
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java b/app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java index e857f0d56..170bf337d 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/DeckLog.java @@ -15,6 +15,9 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import it.niedermann.nextcloud.deck.util.MimeTypeUtil; @@ -23,6 +26,7 @@ public class DeckLog { private static final StringBuffer DEBUG_LOG = new StringBuffer(); private static boolean PERSIST_LOGS = false; private static final String TAG = DeckLog.class.getSimpleName(); + private static final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public static void enablePersistentLogs(boolean persistLogs) { PERSIST_LOGS = persistLogs; @@ -66,7 +70,13 @@ public class DeckLog { final StackTraceElement caller = Thread.currentThread().getStackTrace()[stackTracePosition]; final String print = "(" + caller.getFileName() + ":" + caller.getLineNumber() + ") " + caller.getMethodName() + "() → " + TextUtils.join(" ", messages); if (PERSIST_LOGS) { - DEBUG_LOG.append(print).append("\n"); + DEBUG_LOG + .append(dtf.format(Instant.now().atZone(ZoneId.systemDefault()))) + .append(" ") + .append(severity.name()) + .append(" ") + .append(print) + .append("\n"); } switch (severity) { case DEBUG: |