mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
flog: new helper function for debugging to file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
45a374b50a
commit
80e4f025d3
2 files changed
+23
No files matched your search
@@ -130,6 +130,28 @@ done:
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Log to file, intended for debug only.
|
||||||
|
*/
|
||||||
|
void flog(char *file, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char fn[80];
|
||||||
|
va_list ap;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
snprintf(fn, sizeof(fn), "/tmp/%s.log", file);
|
||||||
|
fp = fopen(fn, "a");
|
||||||
|
if (!fp)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(fp, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
Reference in new issue
Block a user