> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFSettingsSetTraceLevel

> Sets the most verbose level of trace events that PlayFabCore, PlayFabServices, and PlayFabGameSave emit in the PlayFab trace area.

Sets the trace level for events in the Microsoft Azure PlayFab trace area.

## Syntax

```cpp theme={null}
HRESULT PFSettingsSetTraceLevel(  
    PFTraceLevel traceLevel  
)  
```

### Parameters

**`traceLevel`**   PFTraceLevel\
*In*

The maximum verbosity to emit. Events at this level and at less verbose levels are emitted, and more verbose events are dropped. In order from least to most verbose, the `PFTraceLevel` values are `Off` (0), `Error` (1), `Warning` (2), `Important` (3), `Information` (4), and `Verbose` (5). Pass `PFTraceLevel::Off` to drop all trace events in the PlayFab trace area.

### Return value

Type: HRESULT

`S_OK` if the trace level is set. `E_INVALIDARG` if `traceLevel` is greater than `PFTraceLevel::Verbose`; in that case, the current trace level doesn't change.

## Remarks

The PlayFab trace area contains the events that `PlayFabCore`, `PlayFabServices`, and `PlayFabGameSave` log. `PlayFabCore` stores the level, and all three libraries use it. The default level is `PFTraceLevel::Verbose`. Each `PFTraceLevel` value equals the matching value of libHttpClient's [HCTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/enums/hctracelevel.md).

You can call this function at any time, including before [PFInitialize](https://docs.xbox.com/services/playfab/api-references/c/pfcore/functions/pfinitialize.md). The level is stored atomically, so you can call this function from any thread. The level stays in effect after [PFUninitializeAsync](https://docs.xbox.com/services/playfab/api-references/c/pfcore/functions/pfuninitializeasync.md).

This function doesn't change libHttpClient's trace level. To control libHttpClient's HTTP and WebSocket events, call [HCSettingsSetTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/functions/hcsettingssettracelevel.md). After PlayFab is initialized, PlayFab events that pass this filter go to the outputs that you configure through libHttpClient tracing, such as the debugger ([HCTraceSetTraceToDebugger](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracesettracetodebugger.md)) and client callbacks ([HCTraceSetClientCallback](https://docs.xbox.com/reference/live/httpclient/trace/functions/hctracesetclientcallback.md)). They also go to the trace file if a call to [PFTraceEnableTraceToFile](https://docs.xbox.com/services/playfab/api-references/c/pftrace/functions/pftraceenabletracetofile.md) before `PFInitialize` succeeded and the storage handlers can write the file.

The following example sends all PlayFab and libHttpClient trace events to the debugger.

```cpp theme={null}
PFSettingsSetTraceLevel(PFTraceLevel::Verbose);
HCSettingsSetTraceLevel(HCTraceLevel::Verbose);
HCTraceSetTraceToDebugger(true);
```

## Requirements

**Header:** PFTrace.h

**Library:** PlayFabCore.lib

**Supported platforms:** Windows, XBOX One family consoles, and XBOX Series consoles

## See also

[PFTrace members](https://docs.xbox.com/services/playfab/api-references/c/pftrace/pftrace_members.md)\
[Debug tracing](https://docs.xbox.com/services/playfab/sdks/c/tracing.md)


## Related topics

- [Services C API overview - PFTrace.h](https://docs.xbox.com/services/playfab/api-references/c/pftrace/pftrace_members.md)
- [Debug tracing](https://docs.xbox.com/services/playfab/sdks/c/tracing.md)
- [PFTraceEnableTraceToFile](https://docs.xbox.com/services/playfab/api-references/c/pftrace/functions/pftraceenabletracetofile.md)
- [HCSettingsSetTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/functions/hcsettingssettracelevel.md)
- [HCSettingsGetTraceLevel](https://docs.xbox.com/reference/live/httpclient/trace/functions/hcsettingsgettracelevel.md)
