void mix_log_func(const gchar* comp, gint level, const gchar *file, const gchar *func, gint line, const gchar *format, ...) { va_list args; static gchar* loglevel[4] = { "**ERROR", "*WARNING", "INFO", "VERBOSE" }; const gchar *env_mix_log_level = NULL; gint mix_log_level_threhold = MIX_LOG_LEVEL_VERBOSE; if(!mix_log_enabled()) { return; } if (!format) { return; } g_static_mutex_lock(&g_mutex); /* log level */ env_mix_log_level = g_getenv(MIX_LOG_LEVEL); if (env_mix_log_level) { mix_log_level_threhold = atoi(env_mix_log_level); } if (level > mix_log_level_threhold) { goto exit; } /* component */ if (mix_shall_delog(comp, MIX_DELOG_COMPS)) { goto exit; } /* files */ if (mix_shall_delog(file, MIX_DELOG_FILES)) { goto exit; } /* functions */ if (mix_shall_delog(func, MIX_DELOG_FUNCS)) { goto exit; } if (level > MIX_LOG_LEVEL_VERBOSE) { level = MIX_LOG_LEVEL_VERBOSE; } if (level < MIX_LOG_LEVEL_ERROR) { level = MIX_LOG_LEVEL_ERROR; } g_print("%s : %s : %s : ", loglevel[level - 1], file, func); va_start(args, format); g_vprintf(format, args); va_end(args); exit: g_static_mutex_unlock(&g_mutex); }
void dapi_debug_impl (const gchar *domain, const gchar *msg, ...) { gint i; g_return_if_fail (domain != NULL); g_return_if_fail (msg != NULL); debug_init (); for (i = 0; debug_strv && debug_strv[i]; i++) { if (all_domains || strcmp (domain, debug_strv[i]) == 0) { va_list args; g_print ("%s: ", domain); va_start (args, msg); g_vprintf (msg, args); va_end (args); g_print ("\n"); break; } } }
static void lsm_debug_with_level (LsmDebugCategory *category, LsmDebugLevel level, const char *format, va_list args) { if (!lsm_debug_check (category, level)) return; g_vprintf (format, args); g_printf ("\n"); }
void mpid_debug (const char *format, ...) { va_list args; va_start (args, format); if (debug_enabled) g_vprintf (format, args); va_end (args); }
void base_tool_output_color_print (ToolOutputColor color, gboolean color_term, const char *fmt, ...) { va_list argv; g_print ("%s", base_tool_output_color_s (color, color_term)); va_start (argv, fmt); g_vprintf (fmt, argv); va_end (argv); g_print ("%s", base_tool_output_color_s (BASE_TOOL_COLOR_RESET, color_term)); }
printf_arglist_function1(void putresult, cmd_t, result, const char *, format) { va_list argp; arglist_start(argp, format); dbprintf(_("putresult: %d %s\n"), result, cmdstr[result]); g_printf("%s ", cmdstr[result]); g_vprintf(format, argp); fflush(stdout); arglist_end(argp); }
static inline void PUT_STRING (int pfx, const char *format, ...) { va_list varargs; g_print ("%*.*s", pfx, pfx, ""); va_start (varargs, format); g_vprintf (format, varargs); va_end (varargs); g_print ("\n"); }
/* *INDENT-ON* */ static void n_print (const char *format, ...) { va_list args; if (_name) g_print ("%s", _name); va_start (args, format); g_vprintf (format, args); va_end (args); }
void debug_printf (int level, const char *format, ...) { va_list args; if (debug_level < level) return; va_start (args, format); g_vprintf (format, args); va_end (args); }
static void print_with_colorv (CutConsoleUI *console, const gchar *color, gchar const *format, va_list args) { if (console->use_color) { gchar *message; message = g_strdup_vprintf(format, args); g_print("%s%s%s", color, message, CUT_CONSOLE_COLOR_NORMAL); g_free(message); } else { g_vprintf(format, args); } }
/** * g_printf: * @format: a standard printf() format string, but notice * <link linkend="string-precision">string precision pitfalls</link>. * @Varargs: the arguments to insert in the output. * * An implementation of the standard printf() function which supports * positional parameters, as specified in the Single Unix Specification. * * Returns: the number of bytes printed. * * Since: 2.2 **/ gint g_printf (gchar const *format, ...) { va_list args; gint retval; va_start (args, format); retval = g_vprintf (format, args); va_end (args); return retval; }
static void n_print (const char *format, ...) { va_list args; gint retval; if (_name) g_print (_name); va_start (args, format); retval = g_vprintf (format, args); va_end (args); }
void mix_log_func(const gchar* comp, gint level, const gchar *file, const gchar *func, gint line, const gchar *format, ...) { va_list args; static gchar* loglevel[4] = {"**ERROR", "*WARNING", "INFO", "VERBOSE"}; if (!format) { return; } g_static_mutex_lock(&g_mutex); if (level > g_mix_log_level) { goto exit; } if (g_decom_ht) { if (g_hash_table_lookup(g_decom_ht, comp)) { goto exit; } } if (g_defile_ht) { if (g_hash_table_lookup(g_defile_ht, file)) { goto exit; } } if (g_defunc_ht) { if (g_hash_table_lookup(g_defunc_ht, func)) { goto exit; } } if(level > MIX_LOG_LEVEL_VERBOSE) { level = MIX_LOG_LEVEL_VERBOSE; } if(level < MIX_LOG_LEVEL_ERROR) { level = MIX_LOG_LEVEL_ERROR; } g_print("%s : %s : %s : ", loglevel[level - 1], file, func); va_start(args, format); g_vprintf(format, args); va_end(args); exit: g_static_mutex_unlock(&g_mutex); }
inline void pip_message_print_warning( const gchar *function, const gchar *format, ...) { va_list args; va_start (args, format); printf("\033[1;31m%32s()\033[0;39m: ", function); g_vprintf(format, args); va_end (args); putchar('\n'); fflush(stdout); }