LogWaitEvent
Appearance
LogWaitEvent waits for event-notification information for which the process registered. You receive the event-key data structure and log entry data from the Logging Service.
For details on event-notification filters, see LogOpenEventNotification.
Syntax
LogWaitEvent(service, pWaitEvent);
Parameters
- service (ULONG) - input
- The class of Logging Service:
- Error Logging
- All other values are reserved for future use.
- pWaitEvent (PVOID) - in/out
- A pointer to the LogWaitEvent parameter packet.
- For Error Logging, this is a pointer to a LWEREQUEST structure.
Returns
- rc (APIRET) - returns
- Return code.
- LogWaitEvent returns the following values:
- 0 No error
- 520 Error LF buf too small
- 523 Error LF invalid service
- 1703 Invalid data pointer
- 1702 Invalid LF packet revision number
- 1704 Invalid LF filename length
- 1705 Invalid LF filename ptr
- 1706 Invalid LF parm packet ptr
- 1709 Invalid logrecord buffer ptr
- 1751 Invalid LF flag
- 1758 RAS invalid log notify id
- 1761 RAS invalid packet size
- 2055 Error LF timeout
- 2508 RAS invalid eventkey ptr
- 2509 RAS invalid pathlen ptr
- 2510 RAS invalid buflen ptr
Remarks
The library LFAPI.LIB must be linked with object files that use LogWaitEvent.
Example Code
#define INCL_LOGGING #include <os2.h> #include <lfdef.h> ULONG service; PVOID pWaitEvent; APIRET rc; rc = LogWaitEvent(service, pWaitEvent);
The following example waits for an event notification from the Error Logging service. The call will wait indefinitely for an event notification.
#define INCL_LOGGING
#include <unidef.h>
#include <os2.h>
#include <stdio.h>
#include <lfdef.h>
{
APIRET rc; /* return code */
ULONG service;
LWEREQUEST log_wait_event_packet;
HLOGNOTIFY log_notify;
EVENTKEY EventKey;
BYTE log_entry_buffer›4096!;
UniChar pathname›512!;
ULONG pathname_length = sizeof(pathname);
service = ERROR_LOGGING_SERVICE;
/* Construct the LogChangeEventFilter parameter packet */
log_wait_event_packet.packet_size = sizeof(LWEREQUEST);
log_wait_event_packet.packet_revision_number = LF_UNI_API;
log_wait_event_packet.LogNotify = log_notify;
log_wait_event_packet.pEventKey = &EventKey;
log_wait_event_packet.pLogEntryBuffer = &log_entry_buffer;
log_wait_event_packet.timeout = 0;
log_wait_event_packet.queue_flags = 0;
log_wait_event_packet.pathname_length = &pathname_length;
log_wait_event_packet.pathname = pathname;
rc = LogWaitEvent(service, /* service */
&log_wait_event_packet) /* parameter packet */
if (rc |= 0)
{
printf("LogWaitEvent error: return code = %d",rc);
return;
}