Godot.Logging 1.2.0

dotnet add package Godot.Logging --version 1.2.0                
NuGet\Install-Package Godot.Logging -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Godot.Logging" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Godot.Logging --version 1.2.0                
#r "nuget: Godot.Logging, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Godot.Logging as a Cake Addin
#addin nuget:?package=Godot.Logging&version=1.2.0

// Install Godot.Logging as a Cake Tool
#tool nuget:?package=Godot.Logging&version=1.2.0                

Godot Logging Library

NuGet version (Godot.Logging)
NuGet version (Godot.Logging)

A C# logging library for the Godot game engine. The library provides several Log Targets needed to log messages in a variety of formats. This is intended to work with the .NET version of Godot (C#). The latest NuGet packages provide targets for .NET 6, .NET 7, and .NET 8.

Version Compatibility

Different versions of Godot.Logging may support different version of the Godot SDK. See below.

Godot.Logging v1.2.* → Godot SDK 4.2.2 or greater
Godot.Logging v1.1.* → Godot SDK 4.0.2 or greater

Usage

Overview

Logging can be configured for use in just a few lines of code.

// Create a configuration for the logger
LogConfiguration config = new LogConfiguration();
config.RegisterTarget(new GDPrintTarget("GodotConsole"));

// Set the configuration
GodotLogger.SetConfiguration(config);

// Start logging messages!
GodotLogger.LogInfo("Hello Godot!");
Logging Exceptions

Exceptions may be logged as well.

try
{
    throw new Exception(exMsg);
}
catch (Exception ex)
{
    GodotLogger.LogException(ex, "An exception occurred.");
}

When logging excpetions, if preferred, the whole stack trace can be outputted in the log with the following setting.

GodotLogger.Instance.Configuration.IncludeExceptionCallStack = true;
Format Rules

Formatting rules (output format in the log) may be specified. In the LogConfiguration, you may specify 1 format rule per log level.

FormatRule infoRule = new FormatRule()
{
    FormatText = "[${level}][${classname}.${methodname}] ${message}",
    FormatLogLevel = LogLevel.Info
};
GodotLogger.Instance.Configuration.ApplyFormattingRule(infoRule);

As seen above, format rules may include macros to indicate parts of the format to be replace with log entry specific information. Here are the current macros that are supported.

${level} - Log level associated with the log entry.
${classname} - Class or type name of the object from where the log entry was invoked.
${methodname} - Name of the method within the object from where the log entry was invoked.
${message} - The actual message recorded for the log entry / event.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Godot.Logging:

Package Downloads
Godot.Console

A console/logging backend for Godot 4 (C#).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 133 7/8/2024
1.1.4 123 6/23/2024
1.1.3 109 6/23/2024
1.1.2 163 9/17/2023
1.1.1 183 6/18/2023
1.1.0 146 6/18/2023