Windows Media Format SDK banner art
PreviousNext

Object Logging Interface

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 logging object interface is IWMDMLogger.

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 timestamp and without a component name
   //
   m_pWMDMLogger->LogString(
WMDMLOG_NOTIMESTAMP, NULL, “No time stamp”
);

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

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

See Also

PreviousNext


© 1999 Microsoft Corporation. All rights reserved.