Defining a new event source for the Windows event viewer
The Windows event viewer is a centralized place where application messages are logged, which system administrators can use to monitor the health of the machine. Registering an event source gives us a chance to store hard-coded, localized strings for our own messages. We can select one programmatically by its associated numeric ID. That way, the messages stay consistent and system administrators have one place to go to, to find them.
In this recipe, we'll create a messages file and store it within a resource DLL. Then, we'll register that file with an event source that's installed to the end user's computer. An application can use this event source to log predefined messages to the event viewer.
Getting ready
Create a Setup project and call it EventSourceInstaller
.
How to do it...
Add a resource file that defines the messages and categories to display in the Windows event viewer. Then, register it with an EventSource...