-2

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).

  • 1
    check the documentation please https://docs.avaloniaui.net/docs/getting-started/logging-errors-and-warnings simple. – user123456 May 12 '23 at 12:26

1 Answers1

0

Avalonia can log warnings and errors using System.Diagnostics.Trace. To enable logging the LogToTrace method call should be present in your Program.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.