Serilog sink for Unity3D, logs to Unity Debugger
Install it through OpenUPM or use the UnityPackage from the Releases page.
openupm add com.serilog.sinks.unity3d
You need add Serilog1 to your project. Your usual options:
var logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Unity3D() .CreateLogger();
If you have a custom implementation of Unity's ILogger
interface, then you can log to that:
ILogger myCustomLogger = new MyCustomLogger(); var logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Unity3D(unityLogger: myCustomLogger) .CreateLogger();
If no logger is provided the library will use UnityEngine.Debug.unityLogger
(which is equivalent of using UnityEngine.Debug.Log()
methods)
You can provide the UnityEngine.Object
context2 and tag parameters for the logger:
public class MyObject : MonoBehaviour { // ... private ILogger _logger = new(); public void DoLog() { _logger .ForContext(this) .WithUnityTag("My custom tag") .Information("This is an info log"); } }For versions before 2.0.0
Set up MainThreadDispatcher.Unity
Upgrade from 1.0.0 to 1.0.1You need to provide the following DLLs:
Version 2.12.0 or later ↩
This is done with a new extension method override which explicitly accepts UnityEngine.Object
. ↩
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4