write

                                                                          +-,--------+
                                                                          V          |
>>-write(-+------+-+-------+-+-------+-+------------+-+------+-+--------+-+----------+-)--><
          +-srvr-+ +-,-src-+ +-,type-+ +-,-category-+ +-,-id-+ +-,-data-+ +-,-string-+

Description

Arguments:

The arguments are:

srvr

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

src

Optional. The event source.

type

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.

category

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

id

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

data

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..

string

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.

Example:

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"
  else
    say "Error writing record" source "rc:" ret ":" SysGetErrorText(ret)


::requires 'winSystm.cls'