/** * Prints a warning message to stderr * if the user has enabled verbose mode. * This is the real function implementation, * use _dbus_verbose() macro in code. * * @param format printf-style format string. */ void _dbus_verbose_real (const char *format, ...) { va_list args; static dbus_bool_t need_pid = TRUE; int len; /* things are written a bit oddly here so that * in the non-verbose case we just have the one * conditional and return immediately. */ if (!_dbus_is_verbose_real()) return; #ifndef DBUS_USE_OUTPUT_DEBUG_STRING /* Print out pid before the line */ if (need_pid) { #if PTHREAD_IN_VERBOSE fprintf (stderr, "%lu: 0x%lx: ", _dbus_pid_for_log (), pthread_self ()); #else fprintf (stderr, "%lu: ", _dbus_pid_for_log ()); #endif } #endif /* Only print pid again if the next line is a new line */ len = strlen (format); if (format[len-1] == '\n') need_pid = TRUE; else need_pid = FALSE; va_start (args, format); #ifdef DBUS_USE_OUTPUT_DEBUG_STRING { char buf[1024]; strcpy(buf,module_name); vsprintf (buf+strlen(buf),format, args); va_end (args); OutputDebugString(buf); } #else vfprintf (stderr, format, args); va_end (args); fflush (stderr); #endif }
/** * Prints a warning message to stderr * if the user has enabled verbose mode. * This is the real function implementation, * use _dbus_verbose() macro in code. * * @param format printf-style format string. */ void _dbus_verbose_real (const char *format, ...) { va_list args; static dbus_bool_t need_pid = TRUE; int len; /* things are written a bit oddly here so that * in the non-verbose case we just have the one * conditional and return immediately. */ if (!_dbus_is_verbose_real()) return; /* Print out pid before the line */ if (need_pid) { #if PTHREAD_IN_VERBOSE fprintf (stderr, "%lu: 0x%lx: ", _dbus_pid_for_log (), pthread_self ()); #else fprintf (stderr, "%lu: ", _dbus_pid_for_log ()); #endif } /* Only print pid again if the next line is a new line */ len = strlen (format); if (format[len-1] == '\n') need_pid = TRUE; else need_pid = FALSE; va_start (args, format); vfprintf (stderr, format, args); va_end (args); fflush (stderr); }
/** * Prints a warning message to stderr * if the user has enabled verbose mode. * This is the real function implementation, * use _dbus_verbose() macro in code. * * @param format printf-style format string. */ void _dbus_verbose_real ( #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS const char *file, const int line, const char *function, #endif const char *format, ...) { va_list args; static dbus_bool_t need_pid = TRUE; int len; /* things are written a bit oddly here so that * in the non-verbose case we just have the one * conditional and return immediately. */ if (!_dbus_is_verbose_real()) return; #ifndef DBUS_USE_OUTPUT_DEBUG_STRING /* Print out pid before the line */ if (need_pid) { #if PTHREAD_IN_VERBOSE fprintf (stderr, "%lu: 0x%lx: ", _dbus_pid_for_log (), pthread_self ()); #else fprintf (stderr, "%lu: ", _dbus_pid_for_log ()); #endif } #endif /* Only print pid again if the next line is a new line */ len = strlen (format); if (format[len-1] == '\n') need_pid = TRUE; else need_pid = FALSE; va_start (args, format); #ifdef DBUS_USE_OUTPUT_DEBUG_STRING { char buf[1024]; strcpy(buf,module_name); #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS sprintf (buf+strlen(buf), "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function); #endif vsprintf (buf+strlen(buf),format, args); va_end (args); OutputDebugStringA(buf); } #else #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS fprintf (stderr, "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function); #endif vfprintf (stderr, format, args); va_end (args); fflush (stderr); #endif }