Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum event_type seems to be wrong #167

Closed
humayunkhan opened this issue Dec 1, 2021 · 2 comments
Closed

enum event_type seems to be wrong #167

humayunkhan opened this issue Dec 1, 2021 · 2 comments

Comments

@humayunkhan
Copy link

In the following header file:
https://github.com/boostorg/log/blob/master/include/boost/log/sinks/event_log_constants.hpp

The enum:
//! Windows event types
enum event_type
{
success = 0, //!< Equivalent to EVENTLOG_SUCCESS
info = 4, //!< Equivalent to EVENTLOG_INFORMATION_TYPE
warning = 2, //!< Equivalent to EVENTLOG_WARNING_TYPE
error = 1 //!< Equivalent to EVENTLOG_ERROR_TYPE
};

is not correct in my opinion.

According to latest Microsoft documentation, valid values for event_type are 0, 1, 2 and 3 only.
Please refer to the following link to verify my claim:
https://docs.microsoft.com/en-in/windows/win32/eventlog/message-text-files#:~:text=message%20definition%20section.-,SeverityNames%3D,-(name%3Dnumber%5B%3Aname

The correct enum should be like this:
//! Windows event types
enum event_type
{
success = 0, //!< Equivalent to EVENTLOG_SUCCESS
info = 1, //!< Equivalent to EVENTLOG_INFORMATION_TYPE
warning = 2, //!< Equivalent to EVENTLOG_WARNING_TYPE
error = 3 //!< Equivalent to EVENTLOG_ERROR_TYPE
};

humayunkhan added a commit to humayunkhan/log that referenced this issue Dec 1, 2021
Refer to the following issue for more details:
boostorg#167
@Lastique
Copy link
Member

Lastique commented Dec 3, 2021

event_type defines constants that are mentioned in the comments. These values are passed to ReportEvent as wType. The values match EVENTLOG_* constants in Windows SDK, so they are correct.

The page you link to describes severity levels, which is not the same as event type. Severity levels are described in the message file, and there Boost.Log does use values from 0 to 3. Severity levels are further associated with message templates, each template having an id. That id is supplied to ReportEvent (as dwEventID), along with substitution strings and event type, to register in the event log.

@Lastique Lastique closed this as completed Dec 3, 2021
@humayunkhan
Copy link
Author

Hi.. Thanks for the clarification.

I need some help on #169
Could you please look into it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants