Share via


Object Logging Interface

banner art

The object logging APIs are used by plug-ins of Windows Media Device Manager to create consistent log entries in a common log file. The logging APIs are implemented as a single COM object with one interface. Components do not need to be certified to use this object.

The object logging interface is the IWMDMLogger interface.

The following example code demonstrates common logging operations, using methods of IWMDMLogger:

{
IWMDMLogger *m_pWMDMLogger;

// Get a pointer to the IWMDMLogger interface.
CoCreateInstance(
CLSID_WMDMLogger,
NULL,
CLSCTX_ALL,
IID_IWMDMLogger,
(void**)&m_pWMDMLogger
);

// Log a string without a time stamp and without a component name.
m_pWMDMLogger->LogString(
WMDMLOG_NOTIMESTAMP, NULL, "No time stamp"
);

// Log an informational string.
m_pWMDMLogger->LogString(
WMDMLOG_SEV_INFO,  "MyComponent", "Info entry"
);

// Log an error with a DWORD.
m_pWMDMLogger->LogDword(
WMDMLOG_SEV_ERROR, "MyComponent",
"CreateFile returned: 0x%08lx", hrRet 
);

// Release the interface.
m_pWMDMLogger->Release();
}

See Also