Expain How this work please?
Hi,
Looking for some good log / debug witing tips and found this. Can someone explain what how this works to a kind of newbie please.
Thanks
int fw__debug_level;
int
fw__debug (char *f, ...)
{
va_list ap;
va_start (ap, f);
if (fw__debug_level >= 2)
{
/* print info commented to stdout */
fprintf (stdout, "\n<!-- \n");
vfprintf (stdout, f, ap);
fprintf (stdout, "\n -->\n");
fflush (stdout);
}
if (fw__debug_level >= 3)
{
/* also print info to stderr */
vfprintf (stderr, f, ap);
fflush (stderr);
}
if (fw__debug_level >= 4)
{
/* also print direct to stdout */
vfprintf (stdout, f, ap);
fflush (stdout);
}
va_end (ap);
return 0;
}
|