Thanks for reaching out!
You can use Stopwatch in C# to measure how long each process takes, then append the elapsed time into a Rich Textbox that acts as your event log. Stopwatch gives accurate timing for any operation, such as your CSV writer and REST API call.
After each process finishes, you simply write the elapsed time into your RichTextBox, which you are already using as an event log. This works for users without admin access, since it does not require the Windows Event Log.
You can also log additional details like results from MessageBox prompts or any custom status messages by appending text into the same RichTextBox
The overall flow is:
1.Start a Stopwatch
2.Run the process (CSV write/ API call)
3.Stop the Stopwatch
4.Append a log entry into the RichTextBox with the time taken.
5.Add any custom message you want.
This keeps all your timing information and messages in one place and avoids the need for elevated permissions.
References: Stopwatch Class (System.Diagnostics) | Microsoft Learn
RichTextBox Class (System.Windows.Forms) | Microsoft Learn
Let me know if you need any further help with this. I will be happy to assist.
If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.