diff --git a/src/log.c b/src/log.c index dc574c9e..cc603a52 100644 --- a/src/log.c +++ b/src/log.c @@ -130,6 +130,28 @@ done: 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: * indent-tabs-mode: t diff --git a/src/log.h b/src/log.h index 6ade9a9b..1a371219 100644 --- a/src/log.h +++ b/src/log.h @@ -51,5 +51,6 @@ void log_exit (void); void log_debug (void); void logit (int prio, const char *fmt, ...); +void flog (char *file, const char *fmt, ...); #endif /* FINIT_LOG_H_ */