Chickensoft.Log.Godot
1.0.8
See the version list below for details.
dotnet add package Chickensoft.Log.Godot --version 1.0.8
NuGet\Install-Package Chickensoft.Log.Godot -Version 1.0.8
<PackageReference Include="Chickensoft.Log.Godot" Version="1.0.8" />
<PackageVersion Include="Chickensoft.Log.Godot" Version="1.0.8" />
<PackageReference Include="Chickensoft.Log.Godot" />
paket add Chickensoft.Log.Godot --version 1.0.8
#r "nuget: Chickensoft.Log.Godot, 1.0.8"
#addin nuget:?package=Chickensoft.Log.Godot&version=1.0.8
#tool nuget:?package=Chickensoft.Log.Godot&version=1.0.8
🪵 Log.Godot
Opinionated logging for C# in Godot, based on Chickensoft.Log.
<p align="center"> <img alt="Chickensoft.Log.Godot" src="Chickensoft.Log.Godot/icon.png" width="200"> </p>
📦 Installation
For logging in pure C# without Godot, see Chickensoft.Log. Note that the TraceWriter
from
Chickensoft.Log will produce output in Godot's console.
Install the latest version of the Chickensoft.Log.Godot and Chickensoft.Log packages from nuget:
dotnet add package Chickensoft.Log
dotnet add package Chickensoft.Log.Godot
🌱 Usage
Essentials
For an overview of the logging system, see Chickensoft.Log. This package provides Chickensoft.Log-compatible writers for output to the Godot debug console and Godot file paths.
If you are using TraceWriter
from the Chickensoft.Log package, you probably should not also use a GDWriter
for output to the Godot debug console in the same log! Godot uses a custom TraceListener
to pick up .NET messages directed through Trace
, so any messages sent to a TraceWriter
will already be directed to the Godot console when run in Godot. Using GDWriter
will only create doubled output.
Setup
public class MyClass
{
// Create a log with the name of MyClass, outputting to the Godot debug console
private ILog _log = new Log(nameof(MyClass), new GDWriter());
}
Logging
public void MyMethod()
{
// Outputs "Info (MyClass): A log message"
_log.Print("A log message");
// Outputs "Warn (MyClass): A warning message"
_log.Warn("A warning message");
// Outputs "Error (MyClass): An error occurred"
_log.Err("An error occurred");
try
{
SomethingThatThrows();
}
catch (Exception e)
{
// Outputs the value of e.ToString(), prefixed by a line labeling it an
// exception, as an error
_log.Print(e);
}
// Outputs the current stack trace as a standard log message
_log.Print(new System.Diagnostics.StackTrace());
}
For details on formatting log messages, see Chickensoft.Log.
✒️ Writer Types
The Chickensoft.Log.Godot package provides two writer types for use with Godot:
GDWriter
: Outputs log messages to the Godot console.GDFileWriter
: Outputs log messages to file using Godot's file I/O system, to support writing files to Godot's"res://"
and"user://"
paths. By default,GDFileWriter
will write to"user://output.log"
, but you can either configure a different default, or configure individualGDFileWriter
s to write to particular files on creation. To avoid concurrency issues,GDFileWriter
is implemented as a pseudo-singleton with a single instance per file name.
Using GDFileWriter
Create a log that outputs messages to the default filename "user://output.log"
:
public class MyClass
{
private ILog _log = new Log(nameof(MyClass), GDFileWriter.Instance());
}
Create a log that outputs messages to a custom filename:
public class MyClass
{
private ILog _log = new Log(nameof(MyClass),
GDFileWriter.Instance("user://CustomFileName.log"));
}
Change the default filename for GDFileWriter
s:
public class Entry
{
public static void Main()
{
// Change the default filename for GDFileWriter before any writers are created
GDFileWriter.DefaultFileName = "user://MyDefaultFileName.log";
}
}
public class MyClass
{
private ILog _log = new Log(nameof(MyClass), GDFileWriter.Instance());
}
Changing the default value for the log file name will affect newly-created
GDFileWriter
s, but will not affect ones that already exist.
💁 Getting Help
Having issues? We'll be happy to help you in the Chickensoft Discord server.
🐣 Package generated from a 🐤 Chickensoft Template — https://chickensoft.games
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Chickensoft.Log (>= 1.0.4)
- GodotSharp (>= 4.4.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.14 | 141 | 6/4/2025 |
1.0.13 | 80 | 5/23/2025 |
1.0.12 | 81 | 5/23/2025 |
1.0.11 | 109 | 5/23/2025 |
1.0.10 | 138 | 5/21/2025 |
1.0.9 | 226 | 5/15/2025 |
1.0.8 | 219 | 5/14/2025 |
1.0.7 | 108 | 5/9/2025 |
1.0.6 | 126 | 5/9/2025 |
1.0.5 | 139 | 5/8/2025 |
1.0.4 | 146 | 5/4/2025 |
1.0.3 | 144 | 5/4/2025 |
1.0.2 | 170 | 4/24/2025 |
1.0.1 | 155 | 4/23/2025 |
1.0.0 | 737 | 2/8/2025 |
Chickensoft.Log.Godot release.