Skip to content

Commit 0e390c3

Browse files
authored
Merge pull request #9 from vutdang/master
Apply changes from fork: vutdang/Unity-File-Debug
2 parents 14fbe47 + ca98889 commit 0e390c3

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

Assets/UnityFileDebug/Lib/Logger/Scripts/DebugWrapper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public enum DLogType
1616
Input,
1717
Network,
1818
Physics
19-
}
20-
19+
}
20+
2121
public static class Debug
2222
{
2323
#region Assert
@@ -36,6 +36,7 @@ public static class Debug
3636
#region Helper
3737
public static void Break() { UnityEngine.Debug.Break(); }
3838
public static void ClearDeveloperConsole() { UnityEngine.Debug.ClearDeveloperConsole(); }
39+
public static bool isDebugBuild { get { return UnityEngine.Debug.isDebugBuild; } }
3940
#endregion
4041

4142
#region Draw
@@ -72,4 +73,4 @@ public static class Debug
7273
public static void LogWarning(object message, DLogType type = DLogType.Warning) { UnityEngine.Debug.LogWarning("[" + type + "] " + message); }
7374
public static void LogWarning(object message, Object context, DLogType type = DLogType.Warning) { UnityEngine.Debug.LogWarning("[" + type + "] " + message, context); }
7475
#endregion
75-
}
76+
}

Assets/UnityFileDebug/Lib/Logger/Scripts/UnityFileDebug.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using UnityEngine;
2-
1+
using UnityEngine;
2+
33
namespace SSS
44
{
55
namespace UnityFileDebug
@@ -12,16 +12,16 @@ public class LogOutput
1212
public string tm; //time
1313
public string l; //log
1414
public string s; //stack
15-
}
16-
15+
}
16+
1717
public enum FileType
1818
{
1919
CSV,
2020
JSON,
2121
TSV,
2222
TXT
23-
}
24-
23+
}
24+
2525
[ExecuteInEditMode]
2626
public class UnityFileDebug : MonoBehaviour
2727
{
@@ -115,8 +115,16 @@ void HandleLog(string logString, string stackTrace, LogType type)
115115
else
116116
{
117117
int end = logString.IndexOf("]");
118-
output.t = logString.Substring(1, end - 1);
119-
output.l = logString.Substring(end + 2);
118+
if (end > 1)
119+
{
120+
output.t = logString.Substring(1, end - 1);
121+
output.l = logString.Substring(end + 2);
122+
}
123+
else
124+
{
125+
output.t = type.ToString();
126+
output.l = logString;
127+
}
120128
}
121129

122130
output.s = stackTrace;
@@ -145,4 +153,4 @@ void HandleLog(string logString, string stackTrace, LogType type)
145153
}
146154
}
147155
}
148-
}
156+
}

0 commit comments

Comments
 (0)