LIB: Add _RAW macros
These macros allow for printing raw strings without any prefix (such as
[DGB] etc.). They are useful for porting existing logging library usage
to the new logging API.
Change-Id: I90acbfb3fb0c9bbe8fc3938b7ac79a82d2151138
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
diff --git a/lib/tfm_vprintf/src/tfm_vprintf.c b/lib/tfm_vprintf/src/tfm_vprintf.c
index 02164ee..7878fb8 100644
--- a/lib/tfm_vprintf/src/tfm_vprintf.c
+++ b/lib/tfm_vprintf/src/tfm_vprintf.c
@@ -15,6 +15,8 @@
#include "tfm_vprintf.h"
+#define LOG_RAW_VALUE UINT8_C(60)
+
static inline const char *get_log_prefix(uint8_t log_level)
{
switch(log_level) {
@@ -213,15 +215,17 @@
void tfm_vprintf(tfm_log_output_str output_func, void *priv, const char *fmt, va_list args)
{
- uint8_t log_level;
+ uint8_t log_marker;
const char spacer = ' ';
/* We expect the LOG_MARKER_* macro as the first character */
- log_level = fmt[0];
+ log_marker = fmt[0];
fmt++;
- output_str_not_formatted(output_func, priv, get_log_prefix(log_level));
- output_char(output_func, priv, spacer);
+ if (log_marker != LOG_RAW_VALUE) {
+ output_str_not_formatted(output_func, priv, get_log_prefix(log_marker));
+ output_char(output_func, priv, spacer);
+ }
tfm_vprintf_internal(output_func, priv, fmt, args);
}