janmechtel / clickkiller

A giant help button to press for software problems
0 stars 0 forks source link

Write log files #3

Open janmechtel opened 1 week ago

janmechtel commented 1 week ago

Would be great to have log files written to disk in the app folder and kept for some time back

janmechtel commented 5 days ago

I got started, but can't figure out how to do this properly.

Ideally I'd imagine there is only 1 (Serilog) logger that writes to appdata rolling log file.

However Velopack requires an ILogger while Avalonia expects an ILogSink.

Now I'm stuck with 2 loggers writing to the same file.

Also I don't understand how I can use the logger elegantly inside App.axaml.cs

see loggin branch

janmechtel commented 4 days ago

Thanks @daleksin for the logging branch

I couldn't really use it as is, but it helped me understand.

  1. Currently I only working clickkiller.Linux
  2. The avalonia app wouldn't run if = new App(logger) was called before using the builder. So I'm trying to use the builder
  3. I believe i need to call the .LogToMySink() Method to make sure avalonia objects log to it, but later I saw you've set Avalonia.Logger.Sink in clickkiller.Windows maybe I can try that again.

Also, I should read this and try it https://docs.avaloniaui.net/docs/guides/implementation-guides/how-to-implement-dependency-injection