#include #include #include #ifdef USE_RIPCON_LOGGER #define JSWM_IPCON_LOG "Jswm_logger" IPCON_HANDLER jswm_log_handler; #endif void jswm_log_init() { #ifdef USE_RIPCON_LOGGER jswm_log_handler = ipcon_create_handler(JSWM_IPCON_LOG, LIBIPCON_FLG_USE_SND_IF); #endif } #define JSWM_MAX_LOG_LEN 512 void jswm_log_printf(const char* fmt, ...) { va_list args; char buf[JSWM_MAX_LOG_LEN]; int len = 0; va_start(args, fmt); len = vsnprintf(buf, JSWM_MAX_LOG_LEN, fmt, args); va_end(args); #ifdef USE_RIPCON_LOGGER ipcon_send_unicast(jswm_log_handler, "ripcon_logger", buf, len + 1); #else fprintf(stderr, "%s", buf); #endif }