This tool is normally run on Windows as a Scheduled Task, meaning the console window is not normally visible. This means that Event Viewer is the most appropriate way to debug the tool's behavior.
.NET allows the creation of Windows Events via System.Diagnostics.EventLog APIs. Naturally, this aassembly is only available on Windows. Unfortunately, it can only be executed as an administrator since Windows Vista, due to the internal requirement of verifying if the event should exist under the "Security" log category, which is only readable as an administrator.
This PR adds the following changes:
Creates the new event log source and logname if it does not yet exist in the current machine. This change now requires the tool to run as administrator.
Splits the Log class into partial implementations so the tool can work on both Windows and non-Windows apps (no event logging on the latter).
Prevents CA1416 (API called on unsupported platform) inside the non-Windows Log partial implementation by using an intermediate enum.
Captures any global exception, logs an event, then throws.
This tool is normally run on Windows as a Scheduled Task, meaning the console window is not normally visible. This means that Event Viewer is the most appropriate way to debug the tool's behavior.
.NET allows the creation of Windows Events via System.Diagnostics.EventLog APIs. Naturally, this aassembly is only available on Windows. Unfortunately, it can only be executed as an administrator since Windows Vista, due to the internal requirement of verifying if the event should exist under the "Security" log category, which is only readable as an administrator.
This PR adds the following changes: