Skip to content

Commit ffdddd6

Browse files
authored
Adds Linux log support (#18)
1 parent f669e04 commit ffdddd6

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

Runtime/BugSplat.cs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,21 @@ public IEnumerator Post(Exception exception, ExceptionPostOptions options = null
204204
{
205205
Debug.Log($"BugSplat info: Could not find {editorLogFileInfo.FullName}, skipping...");
206206
}
207+
#elif UNITY_EDITOR_LINUX
208+
var home = Environment.GetEnvironmentVariable("HOME");
209+
var editorLogFilePath = Path.Combine(home, ".config", "unity3d", "Editor.log");
210+
var editorLogFileInfo = new FileInfo(editorLogFilePath);
211+
if (editorLogFileInfo.Exists)
212+
{
213+
options.AdditionalAttachments.Add(editorLogFileInfo);
214+
}
215+
else
216+
{
217+
Debug.Log($"BugSplat info: Could not find {editorLogFileInfo.FullName}, skipping...");
218+
}
207219
#else
208-
Debug.Log($"BugSplat info: CaptureEditorLog is not implemented on this platform");
220+
Debug.Log($"BugSplat info: CaptureEditorLog is not implemented on this platform");
209221
#endif
210-
// TODO BG linux
211222
}
212223

213224
if (CapturePlayerLog)
@@ -237,10 +248,21 @@ public IEnumerator Post(Exception exception, ExceptionPostOptions options = null
237248
{
238249
Debug.Log($"BugSplat info: Could not find {playerLogFileInfo.FullName}, skipping...");
239250
}
251+
#elif UNITY_STANDALONE_LINUX
252+
var home = Environment.GetEnvironmentVariable("HOME");
253+
var editorLogFilePath = Path.Combine(home, ".config", "unity3d", Application.companyName, Application.productName, "Player.log");
254+
var editorLogFileInfo = new FileInfo(editorLogFilePath);
255+
if (editorLogFileInfo.Exists)
256+
{
257+
options.AdditionalAttachments.Add(editorLogFileInfo);
258+
}
259+
else
260+
{
261+
Debug.Log($"BugSplat info: Could not find {editorLogFileInfo.FullName}, skipping...");
262+
}
240263
#else
241-
Debug.Log($"BugSplat info: CapturePlayerLog is not implemented on this platform");
264+
Debug.Log($"BugSplat info: CapturePlayerLog is not implemented on this platform");
242265
#endif
243-
// TODO BG linux
244266
}
245267

246268
if (CaptureScreenshots)

0 commit comments

Comments
 (0)