We haven't produced any documentation as far as I know (though the DNN book does cover the event/exception's API's so that's a good resource to start with). I've added a new exception type to the next release, SecurityException, so that it can be utilised in a number of locations, it's not an easy task, and one best dealt with in the upgrade.vb at present, until the next release when the eventing model will make items like this a bit easier.
Anyway, the code I used is as follows:
1. adding the exception type in upgrade.vb (I created an xml file [SecurityExceptionTemplate.xml.resources] with the details, both the definition, and the event schedule details - you can look at the other .xml.resources file to work out the necessary details)
'add new SecurityException
Dim objSecLogController As New Log.EventLog.LogController
Dim xmlSecDoc As New XmlDocument
Dim xmlSecConfigFile As String = Common.Globals.HostMapPath + "Logs\LogConfig\SecurityExceptionTemplate.xml.resources"
Try
xmlSecDoc.Load(xmlSecConfigFile)
Catch exc As FileNotFoundException
' xmlConfigFile = Common.Globals.HostMapPath + "Logs\LogConfig\LogConfigTemplate.xml.resources"
' xmlDoc.Load(xmlConfigFile)
End Try
Dim LogType As XmlNodeList = xmlSecDoc.SelectNodes("/LogConfig/LogTypes/LogType")
Dim LogTypeInfo As XmlNode
For Each LogTypeInfo In LogType
Dim objLogTypeInfo As New Log.EventLog.LogTypeInfo
objLogTypeInfo.LogTypeKey = LogTypeInfo.Attributes("LogTypeKey").Value
objLogTypeInfo.LogTypeFriendlyName = LogTypeInfo.Attributes("LogTypeFriendlyName").Value
objLogTypeInfo.LogTypeDescription = LogTypeInfo.Attributes("LogTypeDescription").Value
objLogTypeInfo.LogTypeCSSClass = LogTypeInfo.Attributes("LogTypeCSSClass").Value
objLogTypeInfo.LogTypeOwner = LogTypeInfo.Attributes("LogTypeOwner").Value
objSecLogController.AddLogType(objLogTypeInfo)
Next
Dim LogTypeConfig As XmlNodeList = xmlSecDoc.SelectNodes("/LogConfig/LogTypeConfig")
Dim LogTypeConfigInfo As XmlNode
For Each LogTypeConfigInfo In LogTypeConfig
Dim objLogTypeConfig As New Log.EventLog.LogTypeConfigInfo
objLogTypeConfig.EmailNotificationIsActive = Convert.ToBoolean(IIf(LogTypeConfigInfo.Attributes("EmailNotificationStatus").Value = "On", True, False))
objLogTypeConfig.KeepMostRecent = LogTypeConfigInfo.Attributes("KeepMostRecent").Value
objLogTypeConfig.LoggingIsActive = Convert.ToBoolean(IIf(LogTypeConfigInfo.Attributes("LoggingStatus").Value = "On", True, False))
objLogTypeConfig.LogTypeKey = LogTypeConfigInfo.Attributes("LogTypeKey").Value
objLogTypeConfig.LogTypePortalID = LogTypeConfigInfo.Attributes("LogTypePortalID").Value
objLogTypeConfig.MailFromAddress = LogTypeConfigInfo.Attributes("MailFromAddress").Value
objLogTypeConfig.MailToAddress = LogTypeConfigInfo.Attributes("MailToAddress").Value
objLogTypeConfig.NotificationThreshold = Convert.ToInt32(LogTypeConfigInfo.Attributes("NotificationThreshold").Value)
objLogTypeConfig.NotificationThresholdTime = Convert.ToInt32(LogTypeConfigInfo.Attributes("NotificationThresholdTime").Value)
objLogTypeConfig.NotificationThresholdTimeType = CType(LogTypeConfigInfo.Attributes("NotificationThresholdTimeType").Value, Services.Log.EventLog.LogTypeConfigInfo.NotificationThresholdTimeTypes)
objSecLogController.AddLogTypeConfigInfo(objLogTypeConfig)
Next
2. Create a new event type - look @ components\providers\logging\event logging\EventLogController.vb, you'll need to edit the ENUM and add your new EventLogType.
3. edit admin\logging\logviewer.ascx if necessary with a unique colour for your new event.
Alternatively, piggyback on one of the existing events- most support passing a message, as well as variours serialised data formats, so you could craft the message to contain your module name at the start.
Cathal