Jump to content

LogChangeEventFilter

From EDM2
Revision as of 21:00, 21 January 2018 by Martini (talk | contribs) (Created page with "LogChangeEventFilter is used to alter the filter that is associated with an event-notification request. In addition to changing the filter, you can specify current entries tha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LogChangeEventFilter is used to alter the filter that is associated with an event-notification request. In addition to changing the filter, you can specify current entries that are to be purged before the filter change takes effect.

Syntax

LogChangeEventFilter(service, pChangeEventFilter);

Parameters

service (ULONG) - input
The class of Logging Service:
Error logging
All other values are reserved for future use.
pChangeEventFilter (PVOID) - input/output
A pointer to the LogChangeEventFilter parameter packet.
For Error Logging, this is a pointer to a LCEFREQUEST structure.

Returns

rc (APIRET) - returns
Return code.

LogChangeEventFilter returns the following values:

  • 0 No error
  • 523 Error lf invalid service
  • 1703 Invalid data pointer
  • 1702 Invalid LF packet revision number
  • 1706 RAS invalid parm packet ptr
  • 1751 Invalid LF flag
  • 1758 RAS invalid log notify id
  • 1761 RAS invalid packet size
  • 2503 RAS notif entry not found
  • 2504 RAS notif entry deleted
  • 2505 RAS entry filter unchanged

Remarks

The library LFAPI.LIB must be linked with object files that use LogChangeEventFilter

Example Code

#define INCL_LOGGING
#include <os2.h>
#include <lfdef.h>

ULONG     service;
PVOID     pChangeEventFilter;
APIRET    rc;

rc = LogChangeEventFilter(service, pChangeEventFilter);

The following example changes the event-notification filter for an event notification to a NULL filter (that is, any Error Log entry that is logged will cause an event notification to be sent). The sample will also purge any event notifications that might be pending at the time the LogChangeEventFilter call is made.

  #define INCL_LOGGING
  #include <unidef.h>
  #include <os2.h>
  #include <stdio.h>
  #include <lfdef.h>

  {
  APIRET rc;                                      /* return code */
  ULONG service;
  LCEFREQUEST change_event_filter_packet;
  HLOGNOTIFY log_notify;

  service =  ERROR_LOGGING_SERVICE;

  /* Construct the LogChangeEventFilter parameter packet */
  change_event_filter_packet.packet_size = sizeof(LCEFREQUEST);
  change_event_filter_packet.packet_revision_number = LF_UNI_API;
  change_event_filter_packet.purge_flags = PURGE_EVENT_NOTIFICATION;
  change_event_filter_packet.LogNotify = log_notify;
  change_event_filter_packet.pFilter = NULL;

  rc = LogChangeEventFilter(service,              /* service */
                 &change_event_filter_packet) /* parameter packet*/
  if (rc |= 0)
     {
      printf("LogChangeEventFilter error: return code = %d",rc);
      return;
     }

Related