mirror of https://github.com/NekoX-Dev/NekoX.git
[C] 尝试提交错误级别日志
This commit is contained in:
parent
f2caf944fb
commit
a328cca4de
|
@ -18,6 +18,7 @@ import java.io.OutputStreamWriter;
|
|||
import java.util.Locale;
|
||||
|
||||
import kotlin.io.FilesKt;
|
||||
import tw.nekomimi.nekogram.ExternalGcm;
|
||||
|
||||
public class FileLog {
|
||||
private OutputStreamWriter streamWriter = null;
|
||||
|
@ -123,11 +124,12 @@ public class FileLog {
|
|||
}
|
||||
|
||||
public static void e(final String message, final Throwable exception) {
|
||||
Log.e(tag, message, exception);
|
||||
ExternalGcm.reportLog(message + "\n\n" + exception.toString());
|
||||
if (!BuildVars.LOGS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
ensureInitied();
|
||||
Log.e(tag, message, exception);
|
||||
if (getInstance().streamWriter != null) {
|
||||
getInstance().logQueue.postRunnable(() -> {
|
||||
try {
|
||||
|
@ -143,6 +145,7 @@ public class FileLog {
|
|||
|
||||
public static void e(final String message) {
|
||||
Log.e(tag, message);
|
||||
ExternalGcm.reportLog(message);
|
||||
if (!BuildVars.LOGS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
@ -161,6 +164,7 @@ public class FileLog {
|
|||
|
||||
public static void e(final Throwable e) {
|
||||
Log.e(tag,"ERR", e);
|
||||
ExternalGcm.reportLog(e.toString());
|
||||
if (!BuildVars.LOGS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package tw.nekomimi.nekogram;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
|
@ -15,6 +17,8 @@ import org.telegram.messenger.GcmPushListenerService;
|
|||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class ExternalGcm {
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
|
@ -52,6 +56,7 @@ public class ExternalGcm {
|
|||
SharedConfig.pushStringStatus = "__FIREBASE_FAILED__";
|
||||
GcmPushListenerService.sendRegistrationToServer(null);
|
||||
});
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("flavor",BuildConfig.FLAVOR);
|
||||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
@ -82,4 +87,12 @@ public class ExternalGcm {
|
|||
GcmPushListenerService.sendRegistrationToServer(SharedConfig.pushString);
|
||||
}
|
||||
|
||||
public static void reportLog(@NotNull String report) {
|
||||
|
||||
if (noGcm) return;
|
||||
|
||||
FirebaseCrashlytics.getInstance().log(report);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue