void svn_dbg__print_props(apr_hash_t *props, const char *header_fmt, ...) { /* We only build this code if SVN_DEBUG is defined. */ #ifdef SVN_DEBUG apr_hash_index_t *hi; va_list ap; va_start(ap, header_fmt); debug_vprintf(header_fmt, ap); va_end(ap); if (props == NULL) { svn_dbg__printf(" (null)\n"); return; } for (hi = apr_hash_first(apr_hash_pool_get(props), props); hi; hi = apr_hash_next(hi)) { const char *name = svn__apr_hash_index_key(hi); svn_string_t *val = svn__apr_hash_index_val(hi); svn_dbg__printf(" '%s' -> '%s'\n", name, val->data); } #endif /* SVN_DEBUG */ }
void debug_printf (const char * fmt, ...) { va_list ap; va_start(ap, fmt); debug_vprintf(fmt, &ap); va_end(ap); }
void profile_timer(int level, const char *module, const char *function, const char *fmt, ...) { va_list ap; static struct timeval last[3]; struct timeval curr; int msec,usec; char buffer[strlen(module)+20]; va_start(ap, fmt); if (level < 0) level=0; if (level > 2) level=2; if (fmt) { gettimeofday(&curr, NULL); msec=(curr.tv_usec-last[level].tv_usec)/1000+ (curr.tv_sec-last[level].tv_sec)*1000; sprintf(buffer, "profile:%s", module); debug_vprintf(1, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap); if (msec >= 100) debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec); else { usec=(curr.tv_usec-last[level].tv_usec)+(curr.tv_sec-last[level].tv_sec)*1000*1000; debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d.%d msec\n", usec/1000, usec%1000); } gettimeofday(&last[level], NULL); } else { gettimeofday(&curr, NULL); for (level = 0 ; level < 3 ; level++) last[level]=curr; } va_end(ap); }
/** * @brief Log timing information. * * @note Normally this function is called via the macro 'profile', which automatically fills in * parameters 'module' and 'function'. * * Successive calls to this function will print the elapsed time between calls, using an * internal timer. To start/reset the internal timer without printing a message, set parameter * 'fmt' to NULL. * * To run multiple timers in parallel, the parameter 'level' can be used. Each invocation will * print the elapsed time to the last invocation with the same level. As an exception, calling * with 'fmt'=NULL wll reset all timers with a level greater or equal to the level parameter. * * Typically, profiling is started by calling profile(0, NULL). Then calls with various levels * can be used to print different intermediate timings. * * @param level level of timer to use (0 to PROFILE_LEVEL_MAX). * @param module name of current module (for logging) * @param function name of current function (for logging) * @param fmt format string Log message to print (as a printf format string), followed by required * parameters as varargs. May be NULL; then no message is printed, and all timers with the * same or higher level are reset. */ void profile_timer(int level, const char *module, const char *function, const char *fmt, ...) { #ifndef _MSC_VER va_list ap; static struct timeval last[PROFILE_LEVEL_MAX+1]; struct timeval curr; double msec; char buffer[strlen(module)+20]; if (level < 0) level=0; if (level > PROFILE_LEVEL_MAX) level=PROFILE_LEVEL_MAX; if (fmt) { gettimeofday(&curr, NULL); msec=(curr.tv_usec-last[level].tv_usec)/((double)1000)+ (curr.tv_sec-last[level].tv_sec)*1000; sprintf(buffer, "profile:%s", module); va_start(ap, fmt); debug_vprintf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap); va_end(ap); debug_printf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 0, " %7.1f ms\n", msec); gettimeofday(&last[level], NULL); } else { gettimeofday(&curr, NULL); while (level <= PROFILE_LEVEL_MAX) last[level++]=curr; } #endif /*_MSC_VER*/ }
void debug_printf2(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) { va_list ap; va_start(ap, fmt); debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap); va_end(ap); }
void debug_printf(int level, const char* fmt, ...) { va_list ap; va_start(ap, fmt); debug_vprintf(level, fmt, ap); va_end(ap); }
void debug_trace(const char* fmt, ...) { debug_printf(DP_TRACE, "TRACE %f: ", timestamp()); va_list ap; va_start(ap, fmt); debug_vprintf(DP_TRACE, fmt, ap); va_end(ap); }
void svn_dbg__printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); debug_vprintf(fmt, ap); va_end(ap); }
void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) { #ifdef _DEBUG_BUILD_ va_list ap; va_start(ap, fmt); debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap); va_end(ap); #endif }
void SB_SA_Util_Debug::debug_printf(const char *pp_where, const char *pp_format, ...) { va_list lv_ap; va_start(lv_ap, pp_format); debug_vprintf(pp_where, pp_format, lv_ap); va_end(lv_ap); }
static void debug_printf(const char *format, ...) { va_list ap; va_start(ap, format); debug_vprintf(format, ap); va_end(ap); }
void error(const char* fmt, ...) { va_list ap; va_start(ap, fmt); debug_vprintf(DP_ERROR, fmt, ap); va_end(ap); abort(); }
void error(const char* fmt, ...) { va_list ap; va_start(ap, fmt); if (!debug_logging) debug_printf(DP_ERROR, "Error: "); debug_vprintf(DP_ERROR, fmt, ap); va_end(ap); abort(); }
void PRINTDEBUGMSG(unsigned int level, const char* fmt, ...) { if (debug_level & level) { va_list ap; va_start(ap, fmt); debug_vprintf(fmt, ap); va_end(ap); } }
debug_agent_printf (const char *fmt, ...) { va_list ap; if (!debug_agent) return; va_start (ap, fmt); debug_vprintf (fmt, ap); va_end (ap); }
int GdError (const char *fmt, ...) { va_list args; int err; va_start (args, fmt); err = debug_vprintf (fmt, args); va_end (args); return err; }
void logfn(char *file, int line, int level, char *fmt, ...) { va_list ap; char fileline[256]; int sz; if (level > garmin_debug) return; va_start(ap, fmt); sz = sprintf(fileline, "%s:%d:%d|", file, line, level); debug_vprintf(0, "", strlen(""), fileline, sz, 1, fmt, ap); va_end(ap); }
int debug_print(const char *format, ...) { int output = 0; va_list args; va_start(args, format); #ifdef DEBUGGING if(debugging) { output += debug_vfprintf(format, args); } #endif /*DEBUGGING*/ #ifdef VERBOSE if(verbose) { output += debug_vprintf(format, args); } #endif /*VERBOSE*/ va_end(args); return output; }
void __assert_msg(const char *msg, ...) { arch_intr_off (); #ifdef UOS_EXCEPTION_STACK //* if have another stack, and current stack is broken or small, // just go to exception as inevitable UOS_STRICT(STACK,) if(!(task_stack_enough( VPRINTF_FRAME )) ) { debug_puts(msg); debug_puts("\nbreak on exception stack\n"); return; } #endif//UOS_EXCEPTION_STACK va_list args; va_start (args, msg); if (0 == debug_vprintf (msg, args) ) //если неудалась печать, обрушусь в стек исключений ARCH_BREAK(); va_end (args); }
void debug_fn(const char *file, long line, const char *function, int level, const char *format, ...) { va_list ap; struct timeval tv; struct tm *tm; char datetime[20]; int year; #ifdef WITH_JOURNALD errno_t ret; va_list ap_fallback; if (!debug_file && !debug_to_stderr) { /* If we are not outputting logs to files, we should be sending them * to journald. * NOTE: on modern systems, this is where stdout/stderr will end up * from system services anyway. The only difference here is that we * can also provide extra structuring data to make it more easily * searchable. */ va_start(ap, format); va_copy(ap_fallback, ap); ret = journal_send(file, line, function, level, format, ap); va_end(ap); if (ret != EOK) { /* Emergency fallback, send to STDERR */ debug_vprintf(format, ap_fallback); debug_fflush(); } va_end(ap_fallback); return; } #endif if (debug_timestamps) { gettimeofday(&tv, NULL); tm = localtime(&tv.tv_sec); year = tm->tm_year + 1900; /* get date time without year */ memcpy(datetime, ctime(&tv.tv_sec), 19); datetime[19] = '\0'; if (debug_microseconds) { debug_printf("(%s:%.6ld %d) [%s] [%s] (%#.4x): ", datetime, tv.tv_usec, year, debug_prg_name, function, level); } else { debug_printf("(%s %d) [%s] [%s] (%#.4x): ", datetime, year, debug_prg_name, function, level); } } else { debug_printf("[%s] [%s] (%#.4x): ", debug_prg_name, function, level); } va_start(ap, format); debug_vprintf(format, ap); va_end(ap); debug_fflush(); }