What logger should i use at AvaloniaUI? I know about Serilog, but is it cross-platform? Is there any built-in tool for this?
Moreover i need to log info to the .log file. This must be cross-platform (Windows, Linux and MacOS).
Avalonia can log warnings and errors using
System.Diagnostics.Trace
. To enable logging theLogToTrace
method call should be present in yourProgram.cs
file:
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
And yes, you can log to file.
By default these trace messages would be logger to your IDE output window. If you want to re-route these messages to different location, use API provided by System.Diagnostics.Trace.
See more info about this at official site.