IPixFactory::SetLogger method

Registers (or clears) a sink for stdout/stderr output drained from PIX-launched child processes (WinPixServices, WinPixEngineHost, etc.). Each drained line is delivered via IPixLogging::ReportLog with SourceType set to PIX_LOGGING_SOURCE_STD_OUTPUT or PIX_LOGGING_SOURCE_STD_ERROR, SourceName set to the producing process id (decimal), SourceInterface set to GUID_NULL, and Message set to the raw, unformatted line content. The drainers always run inside pixapi.dll regardless of whether a sink is registered — this keeps the children's pipes from filling up. Setting logger to nullptr detaches any previously registered sink and causes drained lines to be discarded. May be called at any time; the new sink is observed by drainer threads for subsequent lines. Calls into IPixLogging::ReportLog come from arbitrary pixapi worker threads.

Syntax

HRESULT SetLogger(
    IPixLogging * logger);

Parameters

logger [in]

The sink, or nullptr to clear.

Returns

S_OK on success.

Remarks

Note

The supplied IPixLogging implementation MUST be free-threaded (agile). ReportLog is invoked directly from pixapi-internal drainer threads which are not COM-initialized; combined with IPixLogging being declared [local] (no marshaling proxy is generated), there is no path for marshaling the call across apartments. Implementations whose ReportLog is not safe to call concurrently from arbitrary threads will race or crash.

See also