Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 40e7b12

Browse files
Merge pull request #565 from github-for-unity/fixes/debug-prevent-log-roll
Retain logs when developing
2 parents a1ec1cb + e3d5c40 commit 40e7b12

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/EntryPoint.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,17 @@ private static void Initialize()
4040
var oldLogPath = logPath.Parent.Combine(logPath.FileNameWithoutExtension + "-old" + logPath.ExtensionWithDot);
4141
try
4242
{
43-
oldLogPath.DeleteIfExists();
44-
if (logPath.FileExists())
43+
var shouldRotate = true;
44+
#if DEVELOPER_BUILD
45+
shouldRotate = new FileInfo(logPath).Length > 10 * 1024 * 1024;
46+
#endif
47+
if (shouldRotate)
4548
{
46-
logPath.Move(oldLogPath);
49+
oldLogPath.DeleteIfExists();
50+
if (logPath.FileExists())
51+
{
52+
logPath.Move(oldLogPath);
53+
}
4754
}
4855
}
4956
catch (Exception ex)

0 commit comments

Comments
 (0)