IWMSEventLog Object (C#)
Previous | Next |
IWMSEventLog Object (C#)
The IWMSEventLog object is implemented by the server. A plug-in can call it to log an event to the Windows Event Viewer. The server can log error, warning, or information events. If either an error or a warning event is sent, the server also adds them to the IWMSDiagnosticEvents collection. The server then queries the collection and adds information about the event to the Troubleshooting tab in the Windows Media Services user interface.
- Note This object is available only on Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; and Windows Server 2008.
The plug-in indicates the event type by using a WMS_EVENT_LOG_LEVEL enumeration value containing 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. |
A plug-in can retrieve an IWMSEventLog object from the server context. This is illustrated in the following example.
IWMSEventLog EventLog; Guid EventLogGuid = typeof(IWMSEventLog).GUID; object EventLogObject = (object)m_EventLog; pServerContext.GetAndQueryIUnknownValue( WMSDefines.WMS_SERVER_EVENT_LOG, WMSDefines.WMS_SERVER_EVENT_LOG_ID, ref EventLogGuid, out (object)EventLogObject, 0); EventLog = (IWMSEventLog)EventLogObject;
The server context is first sent to the plug-in when the server calls IWMSBasicPlugin.InitializePlugin.
The IWMSEventLog object exposes the following method.
Method | Description |
LogEvent | Sends an event to the Windows Event Viewer. |
See Also
Previous | Next |