Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions en/manual/troubleshooting/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ The name of the module (such as the script containing the log message) is displa

The console displays log messages from all modules, not just your own scripts. For example, it also displays messages from the @'Stride.Core.Serialization.Contents.ContentManager'.

If you run your game from Visual Studio, log messages are shown in the Visual Studio **Output** window instead.
If you run your game from Visual Studio, log messages are not shown in the **Output** window by default.
To display them, you need to manually register a log listener that writes to `Debug.WriteLine` (see example below).

```csharp
GlobalLogger.GlobalMessageLogged += new TextWriterLogListener(new DebugTextWriter());

// Minimal TextWriter for Output window logging
public class DebugTextWriter : TextWriter
{
public override Encoding Encoding => Encoding.UTF8;
public override void WriteLine(string? value) => Debug.WriteLine(value);
}
```

![Log output window](media/log-output-in-visual-studio.png)

Expand Down Expand Up @@ -133,4 +145,4 @@ namespace MyGame

* [Debug text](debug-text.md)
* [Profiling](profiling.md)
* [Scripts](../scripts/index.md)
* [Scripts](../scripts/index.md)