diff --git a/common/tf_log.c b/common/tf_log.c index 08d3cf481..68f1be49a 100644 --- a/common/tf_log.c +++ b/common/tf_log.c @@ -49,6 +49,20 @@ void tf_log(const char *fmt, ...) va_end(args); } +void tf_log_newline(const char log_fmt[2]) +{ + unsigned int log_level = log_fmt[0]; + + /* Verify that log_level is one of LOG_MARKER_* macro defined in debug.h */ + assert((log_level > 0U) && (log_level <= LOG_LEVEL_VERBOSE)); + assert((log_level % 10U) == 0U); + + if (log_level > max_log_level) + return; + + putchar('\n'); +} + /* * The helper function to set the log level dynamically by platform. The * maximum log level is determined by `LOG_LEVEL` build flag at compile time diff --git a/include/common/debug.h b/include/common/debug.h index ed0e8bf97..a7ca0d788 100644 --- a/include/common/debug.h +++ b/include/common/debug.h @@ -61,8 +61,10 @@ #if LOG_LEVEL >= LOG_LEVEL_ERROR # define ERROR(...) tf_log(LOG_MARKER_ERROR __VA_ARGS__) +# define ERROR_NL() tf_log_newline(LOG_MARKER_ERROR) #else # define ERROR(...) no_tf_log(LOG_MARKER_ERROR __VA_ARGS__) +# define ERROR_NL() #endif #if LOG_LEVEL >= LOG_LEVEL_NOTICE @@ -109,6 +111,7 @@ void __dead2 do_panic(void); void __dead2 __stack_chk_fail(void); void tf_log(const char *fmt, ...) __printflike(1, 2); +void tf_log_newline(const char log_fmt[2]); void tf_log_set_max_level(unsigned int log_level); #endif /* __ASSEMBLER__ */