Home Forums Software Development How to get Tobii's logs? Reply To: How to get Tobii's logs?

Grant [Tobii]

Hi @tzaccai, if you checkout the API documentation for tobii.h::tobii_device_create(), taken from tobii_stream_engine_api.pdf as included with the Tobii Stream Engine API download you show see the relevant code implementation.

void custom_logging( void* log_context, tobii_log_level_t level, char const* text ) {
    // log messages can be filtered by log level if desired
    if( level == TOBII_LOG_LEVEL_ERROR )
        printf( "[%d] %s\n", (int) level, text );

int main() {
    allocation_tracking tracking;
    tracking.total_allocations = 0;
    tracking.current_allocations = 0;

    tobii_custom_alloc_t custom_alloc;
    custom_alloc.mem_context = &tracking;
    custom_alloc.malloc_func = &custom_malloc;
    custom_alloc.free_func = &custom_free;

    tobii_custom_log_t custom_log;
    custom_log.log_context = NULL; // we don't use the log_context in this example
    custom_log.log_func = &custom_logging;

    tobii_api_t* api;
    tobii_error_t error = tobii_api_create( &api, &custom_alloc, &custom_log );
    assert( error == TOBII_ERROR_NO_ERROR );

    error = tobii_api_destroy( api );
    assert( error == TOBII_ERROR_NO_ERROR );

    printf( "Total allocations: %d\n", tracking.total_allocations );
    printf( "Current allocations: %d\n", tracking.current_allocations );

    return 0;

Hopefully this is exactly what you are looking for! Please do let us know how you get on. Best Wishes.