Search code examples
c#logginguwpwindows-iot-core-10

C# Logger for UWP Application with Microsoft IoT


I tried to write a thread safe logger for my UWP Application in C# which runs on a Raspberry Pi with Microsoft IoT but I have no idea where to begin. I tried creating a file in the ApplicationData.Current.LocalFolder but the operations are all async and I can't await them in the lock body of my log method.

Thanks in advance for your help!


Solution

  • The easy way to do it is use nuget to install MetroLog or Serilog

    MetroLog is a good way to log.

    To use MetroLog that you should install MetroLog.

    You can install MetroLog in nuget.

    enter image description here

    It's easy to use and you can see this link below.

    Building a Universal Windows Platform (UWP) Application (Part 4) – Logging w/ MetroLog - Intertech Blog