# QairtLog

Logging API — configure log level and callback.

**Include:** `#include "QairtLog/QairtLog.h"`

- struct QairtLog\_CallbackV1\_t

    - *#include &lt;QairtLog.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtLog\_Callback\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv428QairtLog_Callback_CreateFn_t) create

    - 

- [QairtLog\_Callback\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv426QairtLog_Callback_FreeFn_t) free

    -

- struct QairtLog\_V1\_t

    - *#include &lt;QairtLog.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtLog\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv419QairtLog_CreateFn_t) create

    - 

- [QairtLog\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_FreeFn_t) free

    - 

- [QairtLog\_SetLogLevelFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv424QairtLog_SetLogLevelFn_t) setLogLevel

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtLog\_create([QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t) callbackHandle, const [QairtLog\_Level\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv416QairtLog_Level_t) maxLogLevel, void \*userData, [QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t) \*logHandle)

    - Create a handle to a logger object.

This function can be called before [QairtBackend\_create()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#QairtBackend_8h_1a6d413922a7965e30b8109e58163aed2a).

- Parameters

    - - **callbackHandle** – **[in]** Callback handle for backend-generated logging messages. NULL indicates backend may direct log messages to the default log stream on the target platform when possible (e.g. to logcat in case of Android). Otherwise, manage the callback handle via the Log Callback APIs.
- **maxLogLevel** – **[in]** Maximum level of messages which the backend will generate.
- **userData** – **[in]** Opaque user data pointer that will be forwarded to the callback supplied in *callbackHandle* on every invocation. May be NULL. The same callback function may be registered with multiple loggers using different userData values.
- **logHandle** – **[out]** The created log handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: if logging is successfully initialized.
- QAIRT\_COMMON\_ERROR\_NOT\_SUPPORTED: logging is not supported.
- QAIRT\_LOG\_ERROR\_INVALID\_ARGUMENT: if one or more arguments is invalid.
- QAIRT\_LOG\_ERROR\_MEM\_ALLOC: for memory allocation errors.
- QAIRT\_LOG\_ERROR\_INITIALIZATION: log init failed.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurence (successful recovery)
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurence (unsuccessful recovery)

Note

Use corresponding API through [QairtLog\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#structQairtLog__V1__t).

Warning

With different logging level enabled, the inference time may vary.

Warning

The callback function pointer and userData are currently global and will be overwritten by each subsequent call to QairtLog\_create that supplies a non-null callback. Only the most recently registered (callback, userData) pair will be active at any given time. Loggers created with a NULL (default) callback will still use the default callback regardless of non-null callback registration. This limitation will be removed in a future release.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtLog\_free([QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t) logHandle)

    - Frees a log handle.

- Parameters

    - **logHandle** – **[in]** A handle to a created logger.

- Returns

    - Error code:

- QAIRT\_SUCCESS: No error encountered, logging is terminated.
- QAIRT\_LOG\_ERROR\_MEM\_ALLOC: error related to memory deallocation
- QAIRT\_LOG\_ERROR\_INVALID\_HANDLE: *logHandle* is not a valid handle

Note

Use corresponding API through [QairtLog\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#structQairtLog__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtLog\_setLogLevel([QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t) logHandle, const [QairtLog\_Level\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv416QairtLog_Level_t) maxLogLevel)

    - A function to change the log level for the supplied log handle.

- Parameters

    - - **logHandle** – **[in]** A created log handle.
- **maxLogLevel** – **[in]** New maximum log level.

- Returns

    - Error code:

- QAIRT\_SUCCESS: if the level is changed successfully.
- QAIRT\_LOG\_ERROR\_INVALID\_ARGUMENT: if maxLogLevel is not a valid QairtLog\_Level\_t level.
- QAIRT\_LOG\_ERROR\_INVALID\_HANDLE: *logHandle* is not a valid handle
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurence (successful recovery)
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurence (unsuccessful recovery)

Note

Use corresponding API through [QairtLog\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#structQairtLog__V1__t).

Warning

With different logging level enabled, the inference time may vary.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtLog\_Callback\_create([QairtLog\_CallbackFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv421QairtLog_CallbackFn_t) callback, [QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t) \*callbackHandle)

    - Create a handle to a logging callback object.

This function can be called before [QairtBackend\_create()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#QairtBackend_8h_1a6d413922a7965e30b8109e58163aed2a).

- Parameters

    - - **callback** – **[in]** User supplied callback for backend-generated logging messages.
- **callbackHandle** – **[out]** The created callback handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: if logging is successfully initialized.
- QAIRT\_LOG\_ERROR\_INVALID\_ARGUMENT: if one or more arguments is invalid.
- QAIRT\_LOG\_ERROR\_MEM\_ALLOC: for memory allocation errors.

Note

Use corresponding API through [QairtLog\_CallbackV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#structQairtLog__CallbackV1__t).

Warning

Callback implementation may cause inference time to vary.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtLog\_Callback\_free([QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t) callbackHandle)

    - A function to free the callback handle.

- Parameters

    - **callbackHandle** – **[in]** User supplied callback for backend-generated logging messages.

- Returns

    - Error code:

- QAIRT\_SUCCESS: the handle was freed.
- QAIRT\_LOG\_ERROR\_INVALID\_ARGUMENT: if one or more arguments is invalid.
- QAIRT\_LOG\_ERROR\_MEM\_ALLOC: for memory allocation errors.

Note

Use corresponding API through [QairtLog\_CallbackV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#structQairtLog__CallbackV1__t).

Enums

- enum QairtLog\_Error\_t

    - QAIRT Log API result / error codes.

*Values:*

- enumerator QAIRT\_LOG\_MIN\_ERROR = QAIRT\_MIN\_ERROR\_LOG

    - 

- enumerator QAIRT\_LOG\_NO\_ERROR = QAIRT\_SUCCESS

    - Qairt Log success.

- enumerator QAIRT\_LOG\_ERROR\_MEM\_ALLOC = [QAIRT\_COMMON\_ERROR\_MEM\_ALLOC](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv4N19QairtCommon_Error_t28QAIRT_COMMON_ERROR_MEM_ALLOCE)

    - General error relating to memory allocation in Log API.

- enumerator QAIRT\_LOG\_ERROR\_INITIALIZATION = 11002

    - Unable to initialize logging.

- enumerator QAIRT\_LOG\_ERROR\_INVALID\_ARGUMENT = 11003

    - Invalid argument passed.

- enumerator QAIRT\_LOG\_ERROR\_INVALID\_HANDLE = 11004

    - Invalid log handle passed.

- enumerator QAIRT\_LOG\_MAX\_ERROR = QAIRT\_MAX\_ERROR\_LOG

    - 

- enumerator QAIRT\_LOG\_ERROR\_UNDEFINED = 0x7FFFFFFF

    -

- enum QairtLog\_Level\_t

    - *Values:*

- enumerator QAIRT\_LOG\_LEVEL\_ERROR = 1

    - 

- enumerator QAIRT\_LOG\_LEVEL\_WARN = 2

    - 

- enumerator QAIRT\_LOG\_LEVEL\_INFO = 3

    - 

- enumerator QAIRT\_LOG\_LEVEL\_VERBOSE = 4

    - 

- enumerator QAIRT\_LOG\_LEVEL\_DEBUG = 5

    - Reserved for developer debugging.

- enumerator QAIRT\_LOG\_LEVEL\_MAX = 0x7fffffff

    -

Typedefs

- typedef struct \_QairtLog\_Handle\_t \*QairtLog\_Handle\_t

    - Log handle used to interface with Log APIs.

The handle itself is created and freed by the client.
    Copy to clipboard

- typedef struct \_QairtLog\_CallbackHandle\_t \*QairtLog\_CallbackHandle\_t

    - Log Callback handle used to interface with Log Callback APIs.

The handle itself is created and freed by the client.
    Copy to clipboard

- typedef void (\*QairtLog\_CallbackFn\_t)(const char \*fmt, [QairtLog\_Level\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv416QairtLog_Level_t) level, uint64\_t timestamp, void \*userData, va\_list args)

    - Signature for user-supplied logging callback.

- Param fmt

    - **[in]** Printf-style message format specifier.

- Param level

    - **[in]** Log level for the message. Will not be higher than the maximum specified in QairtLog\_create.

- Param timestamp

    - **[in]** Backend-generated timestamp which is monotonically increasing, but otherwise meaningless.

- Param userData

    - **[in]** User-supplied opaque pointer passed through from QairtLog\_create. May be NULL.

- Param args

    - **[in]** Message-specific parameters, to be used with fmt.

Warning

The backend may call this callback from multiple threads, and expects that it is re-entrant.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtLog\_Callback\_CreateFn\_t)([QairtLog\_CallbackFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv421QairtLog_CallbackFn_t), [QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtLog\_Callback\_FreeFn\_t)([QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtLog\_CreateFn\_t)([QairtLog\_CallbackHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv425QairtLog_CallbackHandle_t), const [QairtLog\_Level\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv416QairtLog_Level_t), void\*, [QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtLog\_FreeFn\_t)([QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtLog\_SetLogLevelFn\_t)([QairtLog\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv417QairtLog_Handle_t), const [QairtLog\_Level\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtLog.html#_CPPv416QairtLog_Level_t))

    -

Defines

- QAIRT\_LOG\_V1\_ID QAIRT\_MIN\_ID\_LOG

    - 

- QAIRT\_LOG\_CALLBACK\_V1\_ID QAIRT\_MIN\_ID\_LOG + 1

    -

Last Published: Jun 04, 2026

[Previous Topic
QairtProfile](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtProfile.md) [Next Topic
QairtSignal](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtSignal.md)