Write GameStudio logs to a temporary folder
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Is your feature request related to a problem? Please describe.
A few times it happened that a person had an issue running Stride, even if they were shown a log, maybe they closed the window and couldn't provide more details.
Describe the solution you'd like
We should save all the logs into a temporary file so that it can be inspected later.
Additional context
I took a look at current log listeners and we can easily add an extension to the TextWriterLogListener:
public class TempFileLogListener : TextWriterLogListener
{
public TempFileLogListener(string prefix)
:base(File.OpenWrite(Path.Combine(Path.GetTempPath(), "Stride", $"{prefix}_{System.DateTime.Now:yyyyMMdd_Hmmss}.log")))
{
}
}
And then attach it when we create logger instances (discussion can be held which of those should be kept in the file):
https://github.com/stride3d/stride/blob/1c8daf98112556c4256e3c900dd6a23fd6ce6920/sources/editor/Stride.GameStudio/Program.cs#L142
https://github.com/stride3d/stride/blob/1c8daf98112556c4256e3c900dd6a23fd6ce6920/sources/shared/Stride.NuGetResolver/NuGetAssemblyResolver.cs#L76
☝ These two is the most important ones - a lot of things uses the GlobalLogger and a lot of problems can occur during NuGet resolution.
https://github.com/stride3d/stride/blob/3eacea405fe7f2c890e859e4fe14a18efd086982/sources/editor/Stride.GameStudio/DebuggingViewModel.cs#L78
https://github.com/stride3d/stride/blob/273dfddd462fd3746569f833e1493700c070b14d/sources/editor/Stride.Assets.Presentation/AssetEditors/GameEditor/Services/EditorGameController.cs#L99
https://github.com/stride3d/stride/blob/273dfddd462fd3746569f833e1493700c070b14d/sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetCollectionViewModel.cs#L481
https://github.com/stride3d/stride/blob/273dfddd462fd3746569f833e1493700c070b14d/sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetSourcesViewModel.cs#L117
https://github.com/stride3d/stride/blob/922ba8bdaa3ea4d2ca9be288a5b5df6a0e48e3bf/sources/editor/Stride.Core.Assets.Editor/ViewModel/SessionViewModel.cs#L252
https://github.com/stride3d/stride/blob/273dfddd462fd3746569f833e1493700c070b14d/sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetSourceTrackerViewModel.cs#L95
There is a lot of small loggerResult's that aren't listened to all over the codebase.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the logger setup in sources/editor/Stride.GameStudio/Program.cs and sources/shared/Stride.NuGetResolver/NuGetAssemblyResolver.cs, then review TextWriterLogListener and the other listed logger creation sites. Determine which logger instances should write to temporary files and verify that GameStudio and NuGet resolution logs remain available for later inspection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100