# Genie Log

Genie Log APIs provide a mechanism to capture logs during the execution of GenAI models.

Logging can be enabled on genie-t2t-run and genie-t2e-run by passing the “–log LEVEL” argument.
This argument collects the logs according to the specified LEVEL and directs them to platform-specific areas:
logcat for Android, ETW and stdout for Windows, and stdout for other platforms.

The accepted logging levels are error, warn, info, and verbose.
The APIs capture both Genie-level logs and backend QNN-level logs.

Additionally, the API allows users to provide a callback for logs, enabling them to choose how they collect logs.
If no callback is provided, the platform-specific methods mentioned above are used.

If the logging APIs are not used, no logs are outputted.

The Log APIs used for this exercise are:

[GenieLog\_create](https://docs.qualcomm.com/doc/80-63442-10/topic/function_GenieLog_8h_1afcf4417c1026fd4657092cbac9d1cd01.html#exhale-function-genielog-8h-1afcf4417c1026fd4657092cbac9d1cd01)

[GenieDialogConfig\_bindLogger](https://docs.qualcomm.com/doc/80-63442-10/topic/function_GenieDialog_8h_1a5e98a421e7f997eba72fdd5610398587.html#exhale-function-geniedialog-8h-1a5e98a421e7f997eba72fdd5610398587)

[GenieLog\_free](https://docs.qualcomm.com/doc/80-63442-10/topic/function_GenieLog_8h_1a6539606b0ded59dccde5204d1c85d325.html#exhale-function-genielog-8h-1a6539606b0ded59dccde5204d1c85d325)

## Example on how to use Log APIs

// Example callback
    void logStdoutCallback(const char* fmt,
                       GenieLog_Level_t level,
                       uint64_t timestamp,
                       va_list argp) {
        const char* levelStr = "";
        switch (level) {
            case GENIE_LOG_LEVEL_ERROR:
                levelStr = " ERROR ";
                break;
            case GENIE_LOG_LEVEL_WARN:
                levelStr = "WARNING";
                break;
            case GENIE_LOG_LEVEL_INFO:
                levelStr = "  INFO ";
                break;
            case GENIE_LOG_LEVEL_VERBOSE:
                levelStr = "VERBOSE";
                break;
        }
        fprintf(stdout, "[%-7s] ", levelStr);
        vfprintf(stdout, fmt, argp);
        fprintf(stdout, "\n");
    }
    
    // Create Log Handle
    GenieLog_Handle_t logHandle = NULL;
    
    // Using the API with nullptr (default callback)
    // GenieLog_create(nullptr, GENIE_LOG_LEVEL_ERROR, &logHandle);
    
    // Using the API with a user-defined callback
    GenieLog_create(logStdoutCallback, GENIE_LOG_LEVEL_ERROR, &logHandle);
    
    // Create Dialog Config
    GenieDialogConfig_Handle_t dialogConfigHandle   = NULL;
    GenieDialogConfig_createFromJson(dialogConfigStr, &dialogConfigHandle);
    
    // Bind Log Handle to Dialog Config
    GenieDialogConfig_bindLogger(dialogConfigHandle, logHandle);
    
    // Create Dialog
    GenieDialog_Handle_t dialogHandle = NULL;
    GenieDialog_create(dialogConfigHandle, &dialogHandle);
    
    // Run Dialog Query API
    GenieDialog_query(dialogHandle, promptStr, GenieDialog_SentenceCode_t::GENIE_DIALOG_SENTENCE_COMPLETE, queryCallback);
    
    // Retrieve logs using the designated platform-specific mechanisms or the user-defined callback.
    
    // Free Log Handle
    GenieLog_free(logHandle);
    Copy to clipboard

Last Published: Jun 04, 2026

[Previous Topic
Genie Engine](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/engine_engine.md) [Next Topic
Genie Profile](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/profile_profile.md)