andrzej-kaczmarek commented on code in PR #3400:
URL: https://github.com/apache/mynewt-core/pull/3400#discussion_r2079595472


##########
sys/log/full/include/log/log.h:
##########
@@ -311,11 +301,23 @@ STATS_SECT_END
 
 /* Trailer support callbacks */
 struct log_trailer_handler {
+    /* Trailer length callback used to get the length of the trailer from 
provided
+     * log entry
+     */
     log_trailer_len_func_t *log_trailer_len;
-    log_trailer_data_len_func_t *log_trailer_data_len;
+    /* Trailer append callback used to append trailer to the log entry */
     log_trailer_append_func_t *log_trailer_append;
+    /* Trailer process callback used to process trailer from the log entry
+     * which gets called at various places where the log entry gets read
+     */
     log_process_trailer_func_t *log_process_trailer;
+    /* Trailer mbuf append callback used to append trailer to the log entry
+     * using the mbufs
+     */
     log_trailer_mbuf_append_func_t *log_trailer_mbuf_append;
+    /* Trailer reset data callback used to reset the trailer data
+     * per log which is defined by the application registering these callbacks
+     */

Review Comment:
   As I mentioned in some other comment, there's no "user data" in the callback 
registration API.



##########
sys/log/full/src/log.c:
##########
@@ -692,7 +679,9 @@ log_append_prepare(struct log *log, uint8_t module, uint8_t 
level,
 #endif
 
 #if MYNEWT_VAL(LOG_FLAGS_TRAILER_SUPPORT)
-    ue->ue_flags |= LOG_FLAGS_TRAILER_SUPPORT;
+    if (log->l_th) {
+        ue->ue_flags |= LOG_FLAGS_TRAILER_SUPPORT;

Review Comment:
   This has the same issue as previous code. If application registers 
callbacks, the flag will be set for each new log entry, even if the application 
doesn't append any trailer data via the callback.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to