V          |
          +-srvr-+ +-,-src-+ +-,type-+ +-,-category-+ +-,-id-+ +-,-data-+ +-,-string-+



The arguments are:


Optional. The name of the server where the event log resides


Optional. The event source.


Optional. The event type for the record. The default is the Error (1) event type. When used, this argument must be the numeric value of a valid event type.


Optional. The event category for the record. The default is 0, which is the same as no category (none.)


Optional. The event identifier for the record.. The default is 0.


Optional. The binary data for the record. The default is none. This is binary information specific to the event being logged and to the source that generated the entry. It could for example be the contents of the processor registers when a device driver got an error, a dump of an invalid packet that was received from the network, etc..


Optional. The default is no string. This last argument can be repeated any number of times. Each additional argument is a string used as a substitution string in the description string.

The event identifier together with the event source name identify a description string contained in a message file that describes the event in more detail. The description string can contain substitution place holders. The substitution strings named by this argument are used to replace the substitution place holders in the description string.

Return value:

This method returns 0 on success, and the operating system error code on failure.


This example writes some fictious data to an event log.

  log = .WindowsEventLog~new

  source     = "MyApplication"
  type       = 4  -- Information
  category   = 22
  id         = 33
  binaryData = "01 1a ff 4b 0C"x

  ret = log~write( , source, type, category, id, binaryData, "String1", "String2")
  if ret == 0 then
    say "Record" source "successfully written"
    say "Error writing record" source "rc:" ret ":" SysGetErrorText(ret)

::requires 'winSystm.cls'