14 #ifndef OPENOCD_HELPER_LOG_H 
   15 #define OPENOCD_HELPER_LOG_H 
   22 #if (defined(IS_MINGW) && (((__GNUC__ << 16) + __GNUC_MINOR__) >= 0x00040004)) 
   23 #define PRINTF_ATTRIBUTE_FORMAT gnu_printf 
   25 #define PRINTF_ATTRIBUTE_FORMAT printf 
   52         const char *
function, 
const char *format, ...)
 
   55         const 
char *function, const 
char *format, va_list args);
 
   57         const 
char *function, const 
char *format, ...)
 
   77         const 
char *function, const 
char *
string);
 
   99 #define LOG_LEVEL_IS(FOO)  ((debug_level) >= (FOO)) 
  101 #define LOG_DEBUG_IO(expr ...) \ 
  103         if (debug_level >= LOG_LVL_DEBUG_IO) \ 
  104             log_printf_lf(LOG_LVL_DEBUG, \ 
  105                 __FILE__, __LINE__, __func__, \ 
  109 #define LOG_DEBUG(expr ...) \ 
  111         if (debug_level >= LOG_LVL_DEBUG) \ 
  112             log_printf_lf(LOG_LVL_DEBUG, \ 
  113                 __FILE__, __LINE__, __func__, \ 
  117 #define LOG_INFO(expr ...) \ 
  118     log_printf_lf(LOG_LVL_INFO, __FILE__, __LINE__, __func__, expr) 
  120 #define LOG_WARNING(expr ...) \ 
  121     log_printf_lf(LOG_LVL_WARNING, __FILE__, __LINE__, __func__, expr) 
  123 #define LOG_ERROR(expr ...) \ 
  124     log_printf_lf(LOG_LVL_ERROR, __FILE__, __LINE__, __func__, expr) 
  126 #define LOG_USER(expr ...) \ 
  127     log_printf_lf(LOG_LVL_USER, __FILE__, __LINE__, __func__, expr) 
  129 #define LOG_USER_N(expr ...) \ 
  130     log_printf(LOG_LVL_USER, __FILE__, __LINE__, __func__, expr) 
  132 #define LOG_OUTPUT(expr ...) \ 
  133     log_printf(LOG_LVL_OUTPUT, __FILE__, __LINE__, __func__, expr) 
  137 #define LOG_TARGET_DEBUG_IO(target, fmt_str, ...) \ 
  138     LOG_DEBUG_IO("[%s] " fmt_str, target_name(target), ##__VA_ARGS__)
 
  140 #define LOG_TARGET_DEBUG(target, fmt_str, ...) \ 
  141     LOG_DEBUG("[%s] " fmt_str, target_name(target), ##__VA_ARGS__)
 
  143 #define LOG_TARGET_INFO(target, fmt_str, ...) \ 
  144     LOG_INFO("[%s] " fmt_str, target_name(target), ##__VA_ARGS__)
 
  146 #define LOG_TARGET_WARNING(target, fmt_str, ...) \ 
  147     LOG_WARNING("[%s] " fmt_str, target_name(target), ##__VA_ARGS__)
 
  149 #define LOG_TARGET_ERROR(target, fmt_str, ...) \ 
  150     LOG_ERROR("[%s] " fmt_str, target_name(target), ##__VA_ARGS__)
 
  156 #define ERROR_NO_CONFIG_FILE            (-2) 
  157 #define ERROR_BUF_TOO_SMALL             (-3) 
  161 #define ERROR_FAIL                      (-4) 
  162 #define ERROR_WAIT                      (-5) 
  164 #define ERROR_TIMEOUT_REACHED           (-6) 
  165 #define ERROR_NOT_IMPLEMENTED           (-7) 
static struct esp_usb_jtag * priv
struct esp_usb_jtag __attribute__
int log_remove_callback(log_callback_fn fn, void *priv)
int log_register_commands(struct command_context *cmd_ctx)
char char * find_nonprint_char(char *buf, unsigned buf_len)
Find the first non-printable character in the char buffer, return a pointer to it.
int log_add_callback(log_callback_fn fn, void *priv)
char * alloc_printf(const char *fmt,...) __attribute__((format(PRINTF_ATTRIBUTE_FORMAT
#define PRINTF_ATTRIBUTE_FORMAT
char * alloc_vprintf(const char *fmt, va_list ap)
void alive_sleep(uint64_t ms)
void log_printf(enum log_levels level, const char *file, unsigned line, const char *function, const char *format,...) __attribute__((format(PRINTF_ATTRIBUTE_FORMAT
void busy_sleep(uint64_t ms)
void log_printf_lf(enum log_levels level, const char *file, unsigned line, const char *function, const char *format,...) __attribute__((format(PRINTF_ATTRIBUTE_FORMAT
void log_socket_error(const char *socket_desc)
void void log_vprintf_lf(enum log_levels level, const char *file, unsigned line, const char *function, const char *format, va_list args)
void(* log_callback_fn)(void *priv, const char *file, unsigned line, const char *function, const char *string)
void void log_init(void)
Initialize logging module.
struct log_callback * next