+struct log_stream *
+log_new_file(const char *path, uns flags)
+{
+ struct log_stream *ls = log_new_stream(sizeof(struct file_stream));
+ struct file_stream *fs = (struct file_stream *) ls;
+ fs->fd = -1;
+ fs->orig_name = xstrdup(path);
+ if (strchr(path, '%'))
+ fs->flags = FF_FORMAT_NAME;
+ fs->flags |= FF_CLOSE_FD | flags;
+ ls->msgfmt = LSFMT_DEFAULT;
+ ls->handler = file_handler;
+ ls->close = file_close;
+
+ time_t now = time(NULL);
+ struct tm *tm = localtime(&now);
+ ASSERT(tm);
+ do_log_switch(fs, tm); // die()'s on errors
+ return ls;
+}
+
+int
+log_switch(void)