Skip to content

Commit 2b4b4a4

Browse files
committed
Update logging system
1 parent 57618ae commit 2b4b4a4

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Assets/ConsentManagementProvider/Scripts/wrapper/CmpDebugUtil.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ public static class CmpDebugUtil
66
{
77
private static bool enableLogging = false;
88
private static bool enableDebugging = false;
9+
private static bool forceEnableSingleLog;
910

11+
private static bool IsLoggingEnabled
12+
{
13+
get
14+
{
15+
var result = enableLogging || forceEnableSingleLog;
16+
forceEnableSingleLog = false;
17+
return result;
18+
}
19+
}
20+
1021
static CmpDebugUtil()
1122
{
1223
EnableGarbageCollectorDebugging(enableDebugging);
1324
EnableCmpLogs(enableLogging);
1425
}
1526

16-
public static void EnableCmpLogs(bool enable)
17-
{
18-
enableLogging = enable;
19-
}
27+
public static void ForceEnableNextCmpLog() => forceEnableSingleLog = true;
28+
29+
public static void EnableCmpLogs(bool enable) => enableLogging = enable;
2030

2131
public static void EnableGarbageCollectorDebugging(bool enable)
2232
{
@@ -26,19 +36,19 @@ public static void EnableGarbageCollectorDebugging(bool enable)
2636

2737
public static void Log(string message)
2838
{
29-
if(enableLogging)
39+
if(IsLoggingEnabled)
3040
Debug.Log(message);
3141
}
3242

3343
public static void LogWarning(string message)
3444
{
35-
if (enableLogging)
45+
if (IsLoggingEnabled)
3646
Debug.LogWarning(message);
3747
}
3848

3949
public static void LogError(string message)
4050
{
41-
//if(enableLogging)
51+
//if(EnableLogging)
4252
Debug.LogError(message);
4353
}
4454
}

0 commit comments

Comments
 (0)