I add the following code to the OpenLogFunction to replace the "[Form or View]" tag with the real Form or View Name.
Let me know what you think.
Function CreateLogDoc (db As NotesDatabase) As NotesDocument
On Error Goto processError
'** exit early if there is no database
If (db Is Nothing) Then
Print "Log database was not defined. CreateLogDoc is exiting."
Exit Function
End If
<br/>
Dim logDoc As New NotesDocument(db)
<br/>
On Error Resume Next
logDoc.Form = formName
logDoc.LogErrorNumber = errNum
logDoc.LogErrorLine = errLine
logDoc.LogErrorMessage = errMsg
logDoc.LogStackTrace = stackTrace
logDoc.LogSeverity = severity
logDoc.LogEventTime = eventTime
logDoc.LogEventType = eventType
logDoc.LogMessage = message
logDoc.LogFromDatabase = thisDatabase
logDoc.LogFromServer = thisServer
<br/>
' add by David Slatter 02/09/2007
' replaces "[View or Form Action]" with the name of the view or document title.
Dim ws As Variant
Dim session As New NotesSession
If (session.CurrentAgent Is Nothing) Then
thisAgent = "[View or Form Action]"
Set ws = New NotesUIWorkspace
If Not ( ws Is Nothing) Then<br/>
If Not ws.CurrentDocument Is Nothing Then<br/>
thisAgent = ws.CurrentDocument.WindowTitle<br/>
Elseif Not (ws.CurrentView Is Nothing) Then<br/>
thisAgent = ws.CurrentView.Viewname<br/>
End If<br/>
End If
Else
thisAgent = session.CurrentAgent.Name
End If
' end of add
<br/>
logDoc.LogFromAgent = thisAgent
logDoc.LogFromMethod = methodName
logDoc.LogAgentLanguage = "LotusScript"
logDoc.LogUserName = userName
logDoc.LogEffectiveName = effName
logDoc.LogAccessLevel = accessLevel
logDoc.LogUserRoles = userRoles
logDoc.LogClientVersion = clientVersion
<br/>
If Not (doc Is Nothing) Then
Dim rtitem As New NotesRichTextItem(logDoc, "LogDocInfo")
rtitem.AppendText("The document associated with this event is:")
rtitem.AddNewline(1)
rtitem.AppendText("Server: " & doc.ParentDatabase.Server)
rtitem.AddNewline(1)
rtitem.AppendText("Database: " & doc.ParentDatabase.FilePath)
rtitem.AddNewline(1)
rtitem.AppendText("UNID: " & doc.UniversalID)
rtitem.AddNewline(1)
rtitem.AppendText("Note ID: " & doc.NoteID)
rtitem.AddNewline(1)
rtitem.AppendText("DocLink: ")
Call rtitem.AppendDocLink(doc, doc.UniversalID)
End If
<br/>
Set CreateLogDoc = logDoc
Exit Function