You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
FORT-186111:Clean up logs
#jira:FORT-186111 #android #kairos #rd:Chris.Babcock #ROBOMERGE-SOURCE: CL 7156580 via CL 7156588 via CL 7169145 #ROBOMERGE-BOT: (v367-6836689) [CL 7169309 by pete procopio in Main branch]
This commit is contained in:
@@ -253,7 +253,7 @@ public class GameActivity extends $${gameActivitySuperClass}$$ implements Surfac
|
||||
static float[] current_gravity = new float[]{0, 0, 0};
|
||||
static float[] current_acceleration = new float[]{0, 0, 0};
|
||||
|
||||
public static Logger Log = new Logger("UE4");
|
||||
public static Logger Log = new Logger("UE4", "GameActivity");
|
||||
|
||||
// From cpufeatures.h AndroidCpuFamily enum
|
||||
private static final int ANDROID_CPU_FAMILY_UNKNOWN = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.epicgames.ue4.network.NetworkChangedManager;
|
||||
//$${gameApplicationImportAdditions}$$
|
||||
|
||||
public class GameApplication extends Application implements LifecycleObserver {
|
||||
private static final Logger Log = new Logger("UE4-" + GameApplication.class.getSimpleName());
|
||||
private static final Logger Log = new Logger("UE4", "GameApp");
|
||||
|
||||
private static boolean isForeground = false;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.epicgames.ue4;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
public class Logger
|
||||
@@ -10,13 +11,18 @@ public class Logger
|
||||
}
|
||||
|
||||
private static ILoggerCallback mCallback = null;
|
||||
private String mTag;
|
||||
private final String mTag;
|
||||
private final String mSecondaryTag;
|
||||
private String mFormattedTag;
|
||||
private String mFormattedMessageTag;
|
||||
|
||||
private static boolean bAllowLogging = true;
|
||||
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||
private static boolean bAllowExceptionLogging = true;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static boolean bPrependSecondaryTag = false;
|
||||
private static boolean bPrependChanged = false;
|
||||
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public static void RegisterCallback(ILoggerCallback callback)
|
||||
{
|
||||
mCallback = callback;
|
||||
@@ -28,20 +34,36 @@ public class Logger
|
||||
bAllowLogging = bAllowExceptionLogging = false;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public static void prependSecondaryTag(boolean prependSecondaryTag) {
|
||||
bPrependSecondaryTag = prependSecondaryTag;
|
||||
bPrependChanged = true;
|
||||
}
|
||||
|
||||
public Logger(String Tag)
|
||||
{
|
||||
this(Tag, "");
|
||||
}
|
||||
|
||||
public Logger(String Tag, String secondaryTag)
|
||||
{
|
||||
mTag = Tag;
|
||||
if(secondaryTag == null) {
|
||||
mSecondaryTag = "";
|
||||
} else {
|
||||
mSecondaryTag = secondaryTag;
|
||||
}
|
||||
}
|
||||
|
||||
public void verbose(String Message)
|
||||
{
|
||||
if (bAllowLogging)
|
||||
{
|
||||
Log.v(mTag, Message);
|
||||
Log.v(getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.LoggerCallback("V/", mTag, Message);
|
||||
mCallback.LoggerCallback("V/", getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +71,11 @@ public class Logger
|
||||
{
|
||||
if (bAllowLogging)
|
||||
{
|
||||
Log.d(mTag, Message);
|
||||
Log.d(getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.LoggerCallback("D/", mTag, Message);
|
||||
mCallback.LoggerCallback("D/", getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,11 +83,11 @@ public class Logger
|
||||
{
|
||||
if (bAllowLogging)
|
||||
{
|
||||
Log.w(mTag, Message);
|
||||
Log.w(getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.LoggerCallback("W/", mTag, Message);
|
||||
mCallback.LoggerCallback("W/", getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +95,11 @@ public class Logger
|
||||
{
|
||||
if (bAllowLogging)
|
||||
{
|
||||
Log.e(mTag, Message);
|
||||
Log.e(getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.LoggerCallback("E/", mTag, Message);
|
||||
mCallback.LoggerCallback("E/", getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +107,42 @@ public class Logger
|
||||
{
|
||||
if (bAllowLogging)
|
||||
{
|
||||
Log.e(mTag, Message, Throwable);
|
||||
Log.e(getFormattedTag(), getFormattedMessage(Message), Throwable);
|
||||
}
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.LoggerCallback("E/", mTag, Message);
|
||||
mCallback.LoggerCallback("E/", getFormattedTag(), getFormattedMessage(Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getFormattedTag()
|
||||
{
|
||||
if(mFormattedTag == null || bPrependChanged)
|
||||
{
|
||||
bPrependChanged = false;
|
||||
if (!TextUtils.isEmpty(mSecondaryTag) && bPrependSecondaryTag)
|
||||
{
|
||||
mFormattedTag = mTag + "-" + mSecondaryTag;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFormattedTag = mTag;
|
||||
}
|
||||
}
|
||||
return mFormattedTag;
|
||||
}
|
||||
|
||||
private String getFormattedMessage(String message)
|
||||
{
|
||||
if (!TextUtils.isEmpty(mSecondaryTag) && !bPrependSecondaryTag)
|
||||
{
|
||||
if(mFormattedMessageTag == null || bPrependChanged)
|
||||
{
|
||||
bPrependChanged = false;
|
||||
mFormattedMessageTag = "[" + mSecondaryTag + "] ";
|
||||
}
|
||||
return mFormattedMessageTag + message;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
public class MulticastBroadcastReceiver extends BroadcastReceiver
|
||||
{
|
||||
public static Logger Log = new Logger("UE4-BroadcastReceiver");
|
||||
public static Logger Log = new Logger("UE4", "BroadcastReceiver");
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SplashActivity extends Activity
|
||||
private Intent GameActivityIntent;
|
||||
private boolean WaitForPermission = false;
|
||||
|
||||
public static Logger Log = new Logger("UE4-SplashActivity");
|
||||
public static Logger Log = new Logger("UE4", "SplashActivity");
|
||||
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
|
||||
public final class NetworkChangedManager {
|
||||
|
||||
private static final Logger Log = new Logger("UE4-NetworkChangedManager");
|
||||
private static final Logger Log = new Logger("UE4", "NetworkChangedManager");
|
||||
private static final String SYSTEM = "NetworkManager";
|
||||
private static final String COMPONENT = "ConnectivityManager";
|
||||
private static final String ACTION_ERROR = "InstanceNotAvailable";
|
||||
|
||||
Reference in New Issue
Block a user