Re: [PATCH 3/5] log: provide missing macros

2021-01-18 Thread Tom Rini
On Mon, Jan 04, 2021 at 08:02:54AM +0100, Heinrich Schuchardt wrote:

> With commit d094a0734cee ("log: allow for message continuation") we have
> defined a special log level and category for message continuation. Let's
> have a macro for using these.
> 
> If logging is enabled log_cont() will create a continuation log output with
> the same logging level and category as the previous message.
> 
> If logging is not enabled, log_cont() will print like printf().
> 
> Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT.
> 
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 3/5] log: provide missing macros

2021-01-07 Thread Simon Glass
On Mon, 4 Jan 2021 at 00:03, Heinrich Schuchardt  wrote:
>
> With commit d094a0734cee ("log: allow for message continuation") we have
> defined a special log level and category for message continuation. Let's
> have a macro for using these.
>
> If logging is enabled log_cont() will create a continuation log output with
> the same logging level and category as the previous message.
>
> If logging is not enabled, log_cont() will print like printf().
>
> Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/log.h | 8 
>  1 file changed, 8 insertions(+)

Reviewed-by: Simon Glass 


[PATCH 3/5] log: provide missing macros

2021-01-03 Thread Heinrich Schuchardt
With commit d094a0734cee ("log: allow for message continuation") we have
defined a special log level and category for message continuation. Let's
have a macro for using these.

If logging is enabled log_cont() will create a continuation log output with
the same logging level and category as the previous message.

If logging is not enabled, log_cont() will print like printf().

Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT.

Signed-off-by: Heinrich Schuchardt 
---
 include/log.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/log.h b/include/log.h
index 34cea802a1..830707ef3d 100644
--- a/include/log.h
+++ b/include/log.h
@@ -156,6 +156,9 @@ static inline int _log_nop(enum log_category_t cat, enum 
log_level_t level,
  */
 #if CONFIG_IS_ENABLED(LOG)
 #define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL)
+#define log_emer(_fmt...)  log(LOG_CATEGORY, LOGL_EMERG, ##_fmt)
+#define log_alert(_fmt...) log(LOG_CATEGORY, LOGL_ALERT, ##_fmt)
+#define log_crit(_fmt...)  log(LOG_CATEGORY, LOGL_CRIT, ##_fmt)
 #define log_err(_fmt...)   log(LOG_CATEGORY, LOGL_ERR, ##_fmt)
 #define log_warning(_fmt...)   log(LOG_CATEGORY, LOGL_WARNING, ##_fmt)
 #define log_notice(_fmt...)log(LOG_CATEGORY, LOGL_NOTICE, ##_fmt)
@@ -163,12 +166,17 @@ static inline int _log_nop(enum log_category_t cat, enum 
log_level_t level,
 #define log_debug(_fmt...) log(LOG_CATEGORY, LOGL_DEBUG, ##_fmt)
 #define log_content(_fmt...)   log(LOG_CATEGORY, LOGL_DEBUG_CONTENT, ##_fmt)
 #define log_io(_fmt...)log(LOG_CATEGORY, LOGL_DEBUG_IO, ##_fmt)
+#define log_cont(_fmt...)  log(LOGC_CONT, LOGL_CONT, ##_fmt)
 #else
 #define _LOG_MAX_LEVEL LOGL_INFO
+#define log_emerg(_fmt, ...)   printf(_fmt, ##__VA_ARGS__)
+#define log_alert(_fmt, ...)   printf(_fmt, ##__VA_ARGS__)
+#define log_crit(_fmt, ...)printf(_fmt, ##__VA_ARGS__)
 #define log_err(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
 #define log_warning(_fmt, ...) printf(_fmt, ##__VA_ARGS__)
 #define log_notice(_fmt, ...)  printf(_fmt, ##__VA_ARGS__)
 #define log_info(_fmt, ...)printf(_fmt, ##__VA_ARGS__)
+#define log_cont(_fmt, ...)printf(_fmt, ##__VA_ARGS__)
 #define log_debug(_fmt, ...)   debug(_fmt, ##__VA_ARGS__)
 #define log_content(_fmt...)   log_nop(LOG_CATEGORY, \
LOGL_DEBUG_CONTENT, ##_fmt)
--
2.29.2