# Recorder functions

Source: [https://docs.qualcomm.com/doc/80-58740-4/topic/recorder-functions.html](https://docs.qualcomm.com/doc/80-58740-4/topic/recorder-functions.html)

The recorder is responsible for collecting logs and has four states: illegal, ready,
            running, and suspend. Logs can be collected in the running state, and configured in the
            ready and suspend states. Except for level configuration operations, other configuration
            operations must be under ready and suspend.

## qcc74xlog\_create

- To create a recorder, you must define a qcc74xlog\_t structure and pass its
                    pointer in, and define a memory array for swapping.
- Returns 0 on success, -1 on failure

     int qcc74xlog_create(qcc74xlog_t *log, void *pool, uint16_t size, uint8_t mode);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| pool | Array for buffering |
| size | User buffered array size |
| mode | QCC74xLOG\_MODE |

    #include "qcc74xlog.h"
    
     #define EXAMPLE_LOG_POOL_SIZE 4096
    
     qcc74xlog_t example_recorder;
     static uint32_t example_pool[EXAMPLE_LOG_POOL_SIZE / 4];
    
     /*!< Create a logger, configure the memory pool, memory pool size, and the mode is synchronization */
     if (0 != qcc74xlog_create((void *)&example_recorder, example_pool, EXAMPLE_LOG_POOL_SIZE, QCC74xLOG_MODE_SYNC)) {
         printf("qcc74xlog_create faild\r\n");
     }Copy to clipboard

## qcc74xlog\_delete

- Delete a recorder
- In ready and suspended states
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_delete(qcc74xlog_t *log);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |

## qcc74xlog\_append

- Add a direct to this recorder. Multiple directs can be added, but a direct can
                    only be added to one recorder.
- In ready and suspended states
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_append(qcc74xlog_t *log, qcc74xlog_direct_t *direct);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| direct | Direct pointer |

## qcc74xlog\_remove

- Remove a direct from the recorder
- In ready and suspended states
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_remove(qcc74xlog_t *log, qcc74xlog_direct_t *direct);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| direct | Direct pointer |

## qcc74xlog\_suspend

- Suspend a recorder
- In ready, running, suspend state
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_suspend(qcc74xlog_t *log);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |

## qcc74xlog\_resume

- Restore a recorder
- In ready, running, suspend state
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_resume(qcc74xlog_t *log);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |

## qcc74xlog\_control

- Configure a recorder
- In the ready and suspended states; when the command is QCC74xLOG\_CMD\_LEVEL, it
                    can be in the running state
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_control(qcc74xlog_t *log, uint32_t command, uint32_t param);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| command | Configuration commands |
| param | Configuration parameters |

`command` and `param` can fill in the following
                parameters:

| Command | Parameters | Description |
| --- | --- | --- |
| QCC74xLOG\_CMD\_FLAG | QCC74xLOG\_FLAG | Configure recorder recording function |
| QCC74xLOG\_CMD\_LEVEL | QCC74xLOG\_LEVEL | Configure the level of recorder recording |
| QCC74xLOG\_CMD\_QUEUE\_POOL | Memory pool address | Configure the memory pool address used for buffering |
| QCC74xLOG\_CMD\_QUEUE\_SIZE | Memory pool size (byte) | Configure the memory pool size used for buffering |
| QCC74xLOG\_CMD\_QUEUE\_RST | NULL | Reset the buffer and clear all contents of the buffer |
| QCC74xLOG\_CMD\_ENTER\_CRITICAL | int (\* enter\_critical)(void) function pointer | Configure the function that enters the critical section |
| QCC74xLOG\_CMD\_EXIT\_CRITICAL | int (\* exit\_critical)(void) function pointer | Configure the function to exit the critical section |
| QCC74xLOG\_CMD\_FLUSH\_NOTICE | int (\* flush\_notice)(void) function pointer | Configure the clear buffer prompt function for multi-threaded<br>                                flush thread work |
| QCC74xLOG\_CMD\_MODE | QCC74xLOG\_MODE | Configure recorder working mode |

## qcc74xlog\_filter

- Configure the tag filter and configure whether to enable the log output
                    corresponding to the tag\_string.
- In ready, suspended, running state
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_filter(qcc74xlog_t *log, void *tag_string, uint8_t enable);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| tag\_string | Tag string |
| enable | Whether to enable |

## qcc74xlog

- Add log information to the recorder, sync mode will directly call
                    qcc74xlog\_flush, async mode calls the configured flush\_notice function
- In running state
- Thread safety
- Returns 0 on success, -1 on failure

    int qcc74xlog(void *log, uint8_t level, void *tag, const char *const file, const char *const func, const long line, const char *format, ...);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |
| level | The level of this log |
| tag | The tag structure pointer of this log |
| file | The file name string pointer of this log |
| func | The function name string pointer of this log |
| line | The line number of this log |
| format | The format string of this log |
| … | Variable length parameter list of this log |

## qcc74xlog\_flush

- Output all log information stored in the queue to all directs configured by the
                    recorder
- In running state
- Thread safety
- Returns 0 on success, -1 on failure

     int qcc74xlog_flush(void *log);Copy to clipboard

| Parameter | Description |
| --- | --- |
| log | Recorder pointer |

**Parent Topic:** [QCC74xLOG](https://docs.qualcomm.com/doc/80-58740-4/topic/qcc74xlog_0.html)

Last Published: Feb 10, 2025

[Previous Topic
Global functions](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/global-functions.md) [Next Topic
BLE](https://docs.qualcomm.com/bundle/publicresource/80-58740-4/topics/ble.md)