Examples: NumErrors property (NotesLog - LotusScript®)

  1. This script gets the number of errors logged and places it into the variable count. Here, NumErrors returns 3.
    Dim currentLog As New NotesLog( "Database log" )
    Dim count As Integer
    Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
    Call currentLog.LogError( 1, "This is error number one" )
    Call currentLog.LogError( 2, "This is error number two" )
    Call currentLog.LogError _
    ( 3, "This is error number three" )
    count = currentLog.NumErrors
  2. This agent script logs actions and errors to a database, and sends an e-mail memo to the agent's owner letting her know how many errors the script logged. For example, if Susanna Tallan owns the Thread Agent and it logs two errors, the script sends a mail memo to Susanna with "Thread Agent logged 2 errors" in the Subject.
    Sub Initialize
      Dim session As New NotesSession
      Dim agent As NotesAgent
      Dim db As NotesDatabase
      Dim doc As NotesDocument
      Set agent = session.CurrentAgent
      Set db = session.CurrentDatabase
      Dim currentLog As New NotesLog _
      ( "Log for " & agent.Name )
      Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
      '...log some actions and errors...
      Set doc = New NotesDocument( db )
      doc.Form = "Memo"
      doc.Subject = agent.Name & " logged " &  _
      currentLog.NumErrors & " errors"
      Call doc.Send( False, agent.Owner )
    End Sub