Skip to content

Commit 519a5e6

Browse files
committed
Logs are no longer truncated after 10,000 characters (Max Log Length). Displayed logs are still truncated but they are copied with no truncation
1 parent c87b4eb commit 519a5e6

File tree

4 files changed

+5
-41
lines changed

4 files changed

+5
-41
lines changed

Plugins/IngameDebugConsole/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= In-game Debug Console (v1.7.0) =
1+
= In-game Debug Console (v1.8.0) =
22

33
Documentation: https://github.com/yasirkula/UnityIngameDebugConsole
44
FAQ: https://github.com/yasirkula/UnityIngameDebugConsole#faq

Plugins/IngameDebugConsole/Scripts/DebugLogItem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public void Initialize( DebugLogRecycledListView listView )
6969
logTextOriginalSize = logText.rectTransform.sizeDelta;
7070
copyLogButtonHeight = ( copyLogButton.transform as RectTransform ).anchoredPosition.y + ( copyLogButton.transform as RectTransform ).sizeDelta.y + 2f; // 2f: space between text and button
7171

72+
logText.maxVisibleCharacters = listView.manager.maxLogLength;
73+
7274
copyLogButton.onClick.AddListener( CopyLog );
7375
#if !UNITY_EDITOR && UNITY_WEBGL
7476
copyLogButton.gameObject.AddComponent<DebugLogItemCopyWebGL>().Initialize( this );

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public class DebugLogManager : MonoBehaviour
201201

202202
[SerializeField]
203203
[Tooltip( "If a log is longer than this limit, it will be truncated. This helps avoid reaching Unity's 65000 vertex limit for UI canvases" )]
204-
private int maxLogLength = 10000;
204+
internal int maxLogLength = 10000;
205205

206206
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
207207
[SerializeField]
@@ -1056,44 +1056,6 @@ public void ReceivedLog( string logString, string stackTrace, LogType logType )
10561056
case LogType.Exception: if( !receiveExceptionLogs ) return; break;
10571057
}
10581058

1059-
// Truncate the log if it is longer than maxLogLength
1060-
int logLength = logString.Length;
1061-
if( stackTrace == null )
1062-
{
1063-
if( logLength > maxLogLength )
1064-
logString = logString.Substring( 0, maxLogLength - 11 ) + "<truncated>";
1065-
}
1066-
else
1067-
{
1068-
logLength += stackTrace.Length;
1069-
if( logLength > maxLogLength )
1070-
{
1071-
// Decide which log component(s) to truncate
1072-
int halfMaxLogLength = maxLogLength / 2;
1073-
if( logString.Length >= halfMaxLogLength )
1074-
{
1075-
if( stackTrace.Length >= halfMaxLogLength )
1076-
{
1077-
// Truncate both logString and stackTrace
1078-
logString = logString.Substring( 0, halfMaxLogLength - 11 ) + "<truncated>";
1079-
1080-
// If stackTrace doesn't end with a blank line, its last line won't be visible in the console for some reason
1081-
stackTrace = stackTrace.Substring( 0, halfMaxLogLength - 12 ) + "<truncated>\n";
1082-
}
1083-
else
1084-
{
1085-
// Truncate logString
1086-
logString = logString.Substring( 0, maxLogLength - stackTrace.Length - 11 ) + "<truncated>";
1087-
}
1088-
}
1089-
else
1090-
{
1091-
// Truncate stackTrace
1092-
stackTrace = stackTrace.Substring( 0, maxLogLength - logString.Length - 12 ) + "<truncated>\n";
1093-
}
1094-
}
1095-
}
1096-
10971059
QueuedDebugLogEntry queuedLogEntry = new QueuedDebugLogEntry( logString, stackTrace, logType );
10981060
DebugLogEntryTimestamp queuedLogEntryTimestamp;
10991061
if( queuedLogEntriesTimestamps != null )

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.ingamedebugconsole",
33
"displayName": "In-game Debug Console",
4-
"version": "1.7.0",
4+
"version": "1.8.0",
55
"documentationUrl": "https://github.com/yasirkula/UnityIngameDebugConsole",
66
"changelogUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)