Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/ulog.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ void ulog_log(ulog_level level, const char *file,
/// @brief Clean up all topic, outputs and other dynamic resources
ulog_status ulog_cleanup(void);

/* ============================================================================
Feature: Array logging
============================================================================ */

void ulog_array_log(ulog_level level, const char *file, int line,
const uint8_t* array, const size_t array_size,
const char *message, ...);

/* ============================================================================
Optional Feature: Disable
============================================================================ */
Expand Down
24 changes: 22 additions & 2 deletions src/ulog.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
| ULOG_BUILD_CONFIG_HEADER_ENABLED | 0 | - | Configuration header mode|
| ULOG_BUILD_CONFIG_HEADER_NAME | "ulog_config.h" | - | Configuration header name|
| ULOG_BUILD_DISABLED | 0 | - | Disable ulog completely |
| ULOG_BUILD_ARRAY_LOGGING | 1 | - | Array formating |
| ULOG_BUILD_ARRAY_MAX_SIZE | 4096 | ULOG_BUILD_ARRAY_LOGGING | Maximum array size |

===================================================================================================================== */

Expand Down Expand Up @@ -1170,8 +1172,8 @@ ulog_status ulog_topic_config(bool enabled) {
// Private
// ================
#ifndef ULOG_BUILD_TOPICS_STATIC_NUM
/* If static count not provided, default to 0 */
#define ULOG_BUILD_TOPICS_STATIC_NUM 0
/* If static count not provided, default to 0 */
#define ULOG_BUILD_TOPICS_STATIC_NUM 0
#endif

/* Dynamic if mode equals DYNAMIC */
Expand Down Expand Up @@ -1867,4 +1869,22 @@ ulog_status ulog_cleanup(void) {
return lock_unlock();
}

/* ============================================================================
Core Feature: Clean up
(`init_*`, depends on: Locking, Outputs, Prefix, Time, Color)
============================================================================ */

// Public
// ================

void ulog_array_log(ulog_level level, const char *file, int line,
const uint8_t *array, const size_t array_size,
const char *message, ...) {
if (lock_lock() != ULOG_STATUS_OK) {
return; // Failed to acquire lock, drop log
}

(void)lock_unlock();
}

#endif // ULOG_BUILD_DISABLED
Loading