Sub Initialize
Dim currentLog As New NotesLog( "Checkup Agent" )
Call currentLog.OpenMailLog( "Jimmy Ho", _
"Log for Checkup Agent" )
Call currentLog.Close
End Sub
メールメッセージは Body アイテムに次の内容を含みます。
04/26/95 12:19:40 PM Checkup Agent starting
Sub Initialize
Dim currentLog As New NotesLog( "Cleansing Agent" )
Call currentLog.OpenMailLog( "Jimmy Ho", _
"Log for Cleansing Agent" )
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.AllDocuments
Set doc = collection.GetFirstDocument
count% = 0
While Not ( doc Is Nothing )
count% = count% + 1
Call currentLog.LogAction( "Processed document " + _
Cstr( count% ) )
Set doc = collection.GetNextDocument( doc )
Wend
Call currentLog.Close
End Sub
データベースに 4 つの文書があるとき、Jimmy Ho は Body アイテムに次の内容を含むメールメモを受信します。
04/26/95 10:50:17 AM Cleansing Agent starting 04/26/95 10:50:17 AM Processed document 1 04/26/95 10:50:17 AM Processed document 2 04/26/95 10:50:17 AM Processed document 3 04/26/95 10:50:17 AM Processed document 4
Sub Initialize
viewName$ = "All by Category"
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim agent As NotesAgent
Dim currentLog As NotesLog
Set db = session.CurrentDatabase
Set agent = session.CurrentAgent
Set currentLog = New NotesLog _
( agent.Name + " Agent in " + _
db.Title + " on " + db.Server )
Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
Set view = db.GetView( viewName$ )
If view Is Nothing Then
Call currentLog.LogError _
( 0, "Unable to find view " + viewName$ )
End If
Call currentLog.Close
End Sub
新規の文書が AGENTLOG.NSF データベースに作成されます。このデータベースにはログ名、現在の日時、エラーコード、エラーの説明が含まれます。