Skip to main content

HCTraceCallback

Receives libHttpClient trace messages so that a game can merge them into its own logs.

Syntax

Parameters

areaName   _In_z_
Type: const char*
Null-terminated name of the trace area that produced the message. libHttpClient uses the HTTPCLIENT and WEBSOCKET areas. Libraries that build on libHttpClient, such as the XBOX services API (XSAPI), report their own areas, for example XSAPI. level   _In_
Type: HCTraceLevel
Trace level of the message. threadId   _In_
Type: uint64_t
ID of the thread that produced the message. On Windows PC and XBOX consoles, this value is the operating system thread ID that GetCurrentThreadId returns. timestamp   _In_
Type: uint64_t
Time of the message, in milliseconds since the most recent initialization that started tracing, that is, the HCInitialize or HCTraceInit call that changed the tracing reference count from zero to one. message   _In_z_
Type: const char*
Null-terminated, formatted trace message. The message doesn’t include the thread, level, time, and area prefix that libHttpClient adds to debugger output.

Return value

Type: void

Remarks

Register the callback by calling HCTraceSetClientCallback. libHttpClient calls the callback synchronously on the thread that produced the trace message. Several threads can call the callback at the same time, so make the callback thread-safe and return quickly. The areaName and message strings are valid only for the duration of the call. Copy them if you need them later. libHttpClient calls the callback only for messages at or below the verbosity of the message’s trace area. To change the verbosity of the libHttpClient trace areas, call HCSettingsSetTraceLevel. Each direct call to HCTraceCleanup removes all registered client callbacks. Library cleanup also removes them when the final cleanup of libHttpClient reaches trace cleanup. Removing the registrations doesn’t wait for a callback that’s already running. Register the callback again after you reinitialize libHttpClient.

Example

The following example assumes that HCInitialize already succeeded.

Requirements

Header: trace.h Library: libHttpClient.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

trace
HCTraceSetClientCallback
HCSettingsSetTraceLevel
HCTraceLevel
Troubleshooting XBOX services APIs
Last modified on October 30, 2026