IWMSEventLog.LogEvent (Visual Basic .NET)

banner art

Previous Next

IWMSEventLog.LogEvent (Visual Basic .NET)

The LogEvent method sends an event to the Windows Event Viewer.

Syntax

  

Parameters

pPluginNamedValues

[in] IWMSNamedValues object passed by the server to the plug-in when it calls the IWMSBasicPlugin.InitializePlugin method. The plug-in does not need to use the object.

ErrorLevel

[in] Member of the WMS_EVENT_LOG_LEVEL enumeration type. This must be one of the following values.

Value Description
WMS_EVENT_LOG_LEVEL_ERROR Indicates significant problems that the end user must be informed of. Error events usually indicate a loss of functionality or data. For example, if a plug-in fails, it must, if possible, log an error event. The server disables any plug-in that logs an error. Furthermore, if an authentication or authorization plug-in fails, the server will no longer allow new connections or allow clients that are connected to request actions that require authorization.
WMS_EVENT_LOG_LEVEL_WARNING Indicates problems that are not immediately significant, but that can lead to future problems.
WMS_EVENT_LOG_LEVEL_INFORMATION Indicates infrequent but significant successful operations.

lErrorCode

[in] Int32 containing the error code associated with the event. If the plug-in is sending an information or warning event, specify 0.

bstrAdditionalInfo

[in] String containing additional information about the event.

Return Values

This method does not return a value.

Example Code

Public Overloads Sub InitializePlugin( _
    ByVal ServerContext As IWMSContext, _
    ByVal NamedValues As WMSNamedValues, _
    ByVal ClassFactory As IWMSClassObject) _
    Implements IWMSBasicPlugin.InitializePlugin

    Try
        m_ClassFactory = ClassFactory
        m_NamedValues = NamedValues

        ServerContext.GetAndQueryIUnknownValue( _
                    WMSDefines.WMS_SERVER_EVENT_LOG, _
                    WMSDefines.WMS_SERVER_EVENT_LOG_ID, _
                    GetType(IWMSEventLog).GUID, _
                    m_EventLog, 0)

        m_EventLog.LogEvent(m_NamedValues, _
                    WMS_EVENT_LOG_LEVEL.WMS_EVENT_LOG_LEVEL_INFORMATION, _
                    0, "Plug-in initialized.")
    Catch
        ' TODO: Handle exceptions.
    End Try
End Sub

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next