getLast

>>--getLast(--+---------+-+----------+--)----------------------><
              +--server-+ +-,-source-+

Determines the absolute record number of the last record in the event log.

Arguments:

The arguments are:

server

Optional. The server where the event log resides.

source

Optional. The event source.

Return value:

On success, the record number of the last (most recently written) event record. On error, the return is the negated system error code.

Example:

This example displays the last record written to application log.


  log = .WindowsEventLog~new~~open
  log~readRecords( , , , log~getLast, 1)
  rec = log~events[1]
  if rec \== .nil then do

    parse var rec type date time "'" src"'" id user computer "'" string "'" "'" data "'"
    say 'Type     : 'type
    say 'Date     : 'date
    say 'Time     : 'time
    say 'Source   : 'src
    say 'ID       : 'id
    say 'UserId   : 'user
    say 'Computer : 'computer
    say 'Detail   : 'string
    say 'Data     : 'data
  end

::requires 'winSystm.cls'

/* Output might be:

Type     : Error
Date     : 02/14/09
Time     : 16:55:08
Source   : Windows Search Service
ID       : 3083
UserId   : N/A
Computer : OSPREY
Detail   : The protocol handler Search.Mapi2Handler.1 cannot be loaded. Error
description: Class not registered.
Data     :

*/