Rate This Document
Findability
Accuracy
Completeness
Readability

Example of Using the Usability API

After the Tracer package is decompressed, the dev_trace_log.h file in the include folder provides a usability API and the invoking method.
1
DEV_TRACE(logLevel, log);
  • logLevel: log level. The value can be DEBUG (0), INFO (1), WARNING (2), ERROR (3), or CRITICAL (4). (If the level of a log is lower than 0, that log is discarded. If it is higher than 4, that log is recorded as CRITICAL.)
  • log: log content. The parameter type is char *.

Example:

  1. Call the API.
    1
    DEV_TRACE(INFO, "this line is a log.");
    

    or:

    1
    DEV_TRACE(1, "this line is a log.");
    
  2. If the generated log file is trace.logxxx (xxx indicates the timestamp), move it to the bin folder. Move dev_trace_log.metadata from the include folder to the bin folder. Go to the bin folder and run the following parsing command:
    1
    ./tracelog parser -tl trace.logxxx -md dev_trace_log.metadata
    
  3. Display the parsing result.
    1
    [2025-05-22 10:48:52] [INFO] [demo.cpp:main:44] this line is a log.