Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd0cc31c authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Add a SharedLog method to log errors w/ stacktrace

Test: manual: ran code using this method and checked log.
Change-Id: I2cea553ae0dd8a8f2f629718e92aa642c62eb120
parent a420b57a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.net.util;

import android.annotation.NonNull;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Log;
@@ -90,6 +91,13 @@ public class SharedLog {
        Log.e(mTag, record(Category.ERROR, msg));
    }

    /**
     * Log an error due to an exception, with the exception stacktrace.
     */
    public void e(@NonNull String msg, @NonNull Throwable e) {
        Log.e(mTag, record(Category.ERROR, msg + ": " + e.getMessage()), e);
    }

    public void i(String msg) {
        Log.i(mTag, record(Category.NONE, msg));
    }