summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSaya Sugiura <ssugiura@jp.adit-jv.com>2021-03-26 02:52:13 +0000
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2021-10-05 11:19:26 +0900
commit3c3ead84aa51abc8d95c5ee974182194949f63c9 (patch)
tree116153d8ccb8ef32dedb1bc3cc6a808c14c6c0da /include
parentcf79abb110c7ff8b5b75c6f48beeddd9d92dfbd3 (diff)
downloadDLT-daemon-3c3ead84aa51abc8d95c5ee974182194949f63c9.tar.gz
lib: Add new interfaces with given buffer
This commit adds new interfaces: - dlt_user_log_write_start_w_given_buffer(): accepts a log buffer as an input. - dlt_user_log_write_finish_w_given_buffer(): finalizes logging and send the message to corresponding output This is to reduce DLT API calls in DLT application as much as possible and avoid allocating dynamic memory within DLT library. The log buffer has to be prepared in DLT application in order to use these interfaces. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
Diffstat (limited to 'include')
-rw-r--r--include/dlt/dlt_user.h.in34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/dlt/dlt_user.h.in b/include/dlt/dlt_user.h.in
index 30eb234..7a2d35e 100644
--- a/include/dlt/dlt_user.h.in
+++ b/include/dlt/dlt_user.h.in
@@ -298,6 +298,30 @@ DltReturnValue dlt_user_log_write_start_id(DltContext *handle,
uint32_t messageid);
/**
+ * Initialize the generation of a DLT log message with given buffer from DLT application.
+ * This can be considered as replacement of dlt_user_log_write_start/dlt_user_log_write_start_id
+ * and other data functions like dlt_user_log_write_string. The fourth, fifth, and sixth arguments
+ * shall be prepared by DLT application; this function is only responsible for checking log
+ * level and setting the given values to context data. This function has to be called first,
+ * when an application is ready to send a new log message with given buffer. This function only
+ * works with combination of dlt_user_log_write_finish_w_given_buffer and the function must only be
+ * called, when return value is bigger than zero. The function only supports verbose mode as of now.
+ * @param handle pointer to an object containing information about one special logging context
+ * @param log pointer to an object containing information about logging context data
+ * @param loglevel this is the current log level of the log message to be sent
+ * @param buffer data with log message
+ * @param size buffer size
+ * @param args_num number of arguments in buffer
+ * @return Value from DltReturnValue enum, DLT_RETURN_TRUE if log level is matching
+ */
+DltReturnValue dlt_user_log_write_start_w_given_buffer(DltContext *handle,
+ DltContextData *log,
+ DltLogLevelType loglevel,
+ char *buffer,
+ size_t size,
+ int32_t args_num);
+
+/**
* Finishing the generation of a DLT log message and sending it to the DLT daemon.
* This function has to be called after writing all the log attributes of a log message.
* @param log pointer to an object containing information about logging context data
@@ -306,6 +330,16 @@ DltReturnValue dlt_user_log_write_start_id(DltContext *handle,
DltReturnValue dlt_user_log_write_finish(DltContextData *log);
/**
+ * Finishing the generation of a DLT log message and sending it to the DLT daemon without
+ * freeing log buffer. This function only works with combination of
+ * dlt_user_log_write_start_w_given_buffer. This function has to be called after writing all
+ * the log attributes of a log message.
+ * @param log pointer to an object containing information about logging context data
+ * @return Value from DltReturnValue enum
+ */
+DltReturnValue dlt_user_log_write_finish_w_given_buffer(DltContextData *log);
+
+/**
* Write a boolean parameter into a DLT log message.
* dlt_user_log_write_start has to be called before adding any attributes to the log message.
* Finish sending log message by calling dlt_user_log_write_finish.