As it was mentioned before some steps should be done to get filterable, well-formatted EventLog records. All these steps can be done manually while SvCom supplies an expert to simplify this process. This expert is available at File | New | Other | SvCom | EventLog resource DLL. On click this expert creates:
- New unit with methods to be called to write into EventLog and corresponding EventIDs and CategoryIDs constants
- Resource DLL to be deployed and registered on client's system. Registration procedure is as simple as possible, it supports COM-style registration with DllRegisterServer call. It means that any setup generation tool can be used with "Register COM server" option to install this DLL
The unit's code is auto-updated every time you modify or save contents of resource DLL. Use the special "Event log messages" tab near the "Code" tab to design event source resources for your application.
There you can enter:
- EventLog journal such as Application, System or Security;
- SourceID, the name of your event source;
- Event categories, if any;
- Used locales - multilanguage support is very simple;
- As soon as resources are stored in DLL the version information is necessay. You can enter it there too.
Event messages can be stored in several blocks. You can add, delete or modify messages, add comment for each message and see code preview immediately.
The unit with EventIDs declarations is updated automatically:
The only thing you need to do after that is to call SvLogMessage or SvLogData method. Your application supports EventLog now. Your events are filterable, well categorized and correctly formatted.
There are no more bunch of warnings about missed resource dlls, just your event messages.
The full source code of this example is available here or can be installed with other SvCom files by setup.