Skip to content

Commit

Permalink
doc: explain adding DefaultTraceListener
Browse files Browse the repository at this point in the history
  • Loading branch information
wlsnmrk committed Feb 3, 2025
1 parent e173831 commit 650ff84
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,27 @@ below for details.
The package provides one additional writer type, `TestWriter`, which may be
useful for testing your code without mocking `ILog` (see below).

### Using `TraceWriter`

To see `TraceWriter`'s output from a Godot application in Visual Studio's
Output pane, add a `DefaultTraceListener` to the system's list of `Trace`
listeners somewhere near your entry point:

```csharp
using System.Diagnostics;

public class MyGodotApp : Node
{
public override void _Ready()
{
Trace.Listeners.Add(new DefaultTraceListener());
}
}
```

This step is necessary with [GoDotTest] test suites as well as games
(or any other Godot-based applications).

### Using `FileWriter`

`FileWriter` provides two static `Instance()` methods for obtaining references
Expand Down Expand Up @@ -267,3 +288,4 @@ public class MyClassTest

[Chickensoft.Log]: https://www.nuget.org/packages/Chickensoft.Log
[log-godot]: https://github.com/chickensoft-games/Log.Godot
[GoDotTest]: https://github.com/chickensoft-games/GoDotTest

0 comments on commit 650ff84

Please sign in to comment.