Bookmark and Share

Thursday, March 15, 2012

Logging using DNN event system

Here is a simple function for logging into the DNN event system, you will see the logs using the administrator user and accessing the event logs page:

    Public Shared Sub logDnnEvent(ByVal title As String, ByVal message As String, ByVal PortalSettings As DotNetNuke.Entities.Portals.PortalSettings)

If elc Is Nothing Then
elc = New DotNetNuke.Services.Log.EventLog.EventLogController()
End If

elc.AddLog(title, message, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
End Sub

You can call this function in every custom component using the code below:

logDnnEvent("Title", "Message", PortalSettings)
And on DNN you will see notifications like these:

1 comment: