From 0689e3dd6752f45f493eceb3edf040fbc7849846 Mon Sep 17 00:00:00 2001 From: oharboe Date: Thu, 28 Feb 2008 08:11:18 +0000 Subject: - Added TARGET_REQ_DEBUGCHAR target_request debugmsg. This provides a better impeadance match for debug output char fn's, e.g. eCos. - Line endings are now added at the caller site of command_print*(). command_print() still adds a line ending - echo of commands in scripts are now available via debug_level instead of forced echo - Added a USER_SAMELINE() for printing without a lineend. git-svn-id: svn://svn.berlios.de/openocd/trunk@364 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/log.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/helper/log.h') diff --git a/src/helper/log.h b/src/helper/log.h index 6c7c3de6..48b43d8e 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -46,7 +46,10 @@ enum log_levels extern void log_printf(enum log_levels level, const char *file, int line, const char *function, const char *format, ...) - __attribute__ ((format (printf, 5, 6))); +__attribute__ ((format (printf, 5, 6))); +extern void log_printfnl(enum log_levels level, const char *file, int line, + const char *function, const char *format, ...) +__attribute__ ((format (printf, 5, 6))); extern int log_register_commands(struct command_context_s *cmd_ctx); extern int log_init(struct command_context_s *cmd_ctx); extern int set_log_output(struct command_context_s *cmd_ctx, FILE *output); @@ -71,34 +74,40 @@ extern int debug_level; /* Avoid fn call and building parameter list if we're not outputting the information. * Matters on feeble CPUs for DEBUG/INFO statements that are involved frequently */ + #define DEBUG(expr ...) \ do { if (debug_level >= LOG_DEBUG) \ - log_printf (LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, expr); \ + log_printfnl (LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) #define INFO(expr ...) \ do { if (debug_level >= LOG_INFO) \ - log_printf (LOG_INFO, __FILE__, __LINE__, __FUNCTION__, expr); \ + log_printfnl (LOG_INFO, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) #define WARNING(expr ...) \ do { \ - log_printf (LOG_WARNING, __FILE__, __LINE__, __FUNCTION__, expr); \ + log_printfnl (LOG_WARNING, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) #define ERROR(expr ...) \ do { \ - log_printf (LOG_ERROR, __FILE__, __LINE__, __FUNCTION__, expr); \ + log_printfnl (LOG_ERROR, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) #define USER(expr ...) \ + do { \ + log_printfnl (LOG_USER, __FILE__, __LINE__, __FUNCTION__, expr); \ + } while(0) + +#define USER_SAMELINE(expr ...) \ do { \ log_printf (LOG_USER, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) #define OUTPUT(expr ...) \ do { \ - log_printf (LOG_OUTPUT, __FILE__, __LINE__, __FUNCTION__, expr); \ + log_printfnl (LOG_OUTPUT, __FILE__, __LINE__, __FUNCTION__, expr); \ } while(0) -- cgit v1.2.3