mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 19:35:10 +01:00
Log/persist refactoring
This commit is contained in:
@@ -19,28 +19,12 @@ package eu.faircode.email;
|
||||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class TrafficStatsHelper {
|
||||
private static Context ctx;
|
||||
|
||||
static void init(Context context) {
|
||||
ctx = context;
|
||||
}
|
||||
|
||||
public static void connect(String host, int port, String prefix) {
|
||||
String msg = "Connected " + prefix + " " + host + ":" + port;
|
||||
if (ctx == null)
|
||||
Log.i(msg);
|
||||
else
|
||||
EntityLog.log(ctx, EntityLog.Type.Statistics, msg);
|
||||
Log.persist("Connected " + prefix + " " + host + ":" + port);
|
||||
}
|
||||
|
||||
public static void report(String host, String prefix, long sent, long received) {
|
||||
String msg = "Disconnected " + prefix + " " + host + " tx=" + sent + " rx=" + received;
|
||||
if (ctx == null)
|
||||
Log.i(msg);
|
||||
else
|
||||
EntityLog.log(ctx, EntityLog.Type.Statistics, msg);
|
||||
Log.persist("Disconnected " + prefix + " " + host + " tx=" + sent + " rx=" + received);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user