From 3457f2349ecf71220c246347764b3a30903bbf29 Mon Sep 17 00:00:00 2001 From: Juuso Alasuutari Date: Sun, 18 Jan 2009 02:31:56 +0200 Subject: [PATCH] Add lash_warn(). --- common/debug.h | 8 ++++++-- lashd/log.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/debug.h b/common/debug.h index 451ebbe2..3df1f7c3 100644 --- a/common/debug.h +++ b/common/debug.h @@ -25,6 +25,7 @@ #define ANSI_BOLD_ON "\033[1m" #define ANSI_BOLD_OFF "\033[22m" #define ANSI_COLOR_RED "\033[31m" +#define ANSI_COLOR_YELLOW "\033[33m" #define ANSI_RESET "\033[0m" #include @@ -45,8 +46,9 @@ # define LASH_LOG_LEVEL_DEBUG 0 # define LASH_LOG_LEVEL_INFO 1 -# define LASH_LOG_LEVEL_ERROR 2 -# define LASH_LOG_LEVEL_ERROR_PLAIN 3 +# define LASH_LOG_LEVEL_WARN 2 +# define LASH_LOG_LEVEL_ERROR 3 +# define LASH_LOG_LEVEL_ERROR_PLAIN 4 void lash_log(unsigned int level, @@ -61,6 +63,7 @@ lash_log(unsigned int level, # endif /* LASH_DEBUG */ # define lash_info(fmt, args...) lash_log(LASH_LOG_LEVEL_INFO, fmt "\n", ## args) +# define lash_warn(fmt, args...) lash_log(LASH_LOG_LEVEL_WARN, ANSI_COLOR_YELLOW "WARNING: " ANSI_RESET "%s: " fmt "\n", __func__, ## args) # define lash_error(fmt, args...) lash_log(LASH_LOG_LEVEL_ERROR, ANSI_COLOR_RED "ERROR: " ANSI_RESET "%s: " fmt "\n", __func__, ## args) # define lash_error_plain(fmt, args...) lash_log(LASH_LOG_LEVEL_ERROR_PLAIN, ANSI_COLOR_RED "ERROR: " ANSI_RESET fmt "\n", ## args) @@ -74,6 +77,7 @@ lash_log(unsigned int level, # endif /* LASH_DEBUG */ # define lash_info(fmt, args...) printf(fmt "\n", ## args) +# define lash_warn(fmt, args...) printf(fmt "\n", ## args) # define lash_error(fmt, args...) fprintf(stderr, "%s: " fmt "\n", __func__, ## args) # define lash_error_plain(fmt, args...) fprintf(stderr, fmt "\n", ## args) diff --git a/lashd/log.c b/lashd/log.c index 3bf4996a..e61c21e7 100644 --- a/lashd/log.c +++ b/lashd/log.c @@ -168,6 +168,7 @@ lash_log( case LASH_LOG_LEVEL_INFO: stream = stdout; break; + case LASH_LOG_LEVEL_WARN: case LASH_LOG_LEVEL_ERROR: case LASH_LOG_LEVEL_ERROR_PLAIN: default: