#include <fcntl.h>
#include <unistd.h>
#include <time.h>
+#include <errno.h>
struct file_stream {
struct log_stream ls; // ls.name is the current name of the log file
do_log_switch(fs, m->tm);
int r = write(fs->fd, m->m, m->m_len);
- /* FIXME: check for errors here? */
- return 0;
+ return ((r < 0) ? errno : 0);
}
struct log_stream *
uns use_count; // Number of references to the stream
int (*filter)(struct log_stream* ls, struct log_msg *m); // Filter function, return non-zero to discard the message
clist substreams; // Pass the message to these streams (simple_list of pointers)
- int (*handler)(struct log_stream *ls, struct log_msg *m); // Called to commit the message
+ int (*handler)(struct log_stream *ls, struct log_msg *m); // Called to commit the message, return 0 for success, errno on error
void (*close)(struct log_stream* ls); // Called upon log_close_stream()
// Private data of the handler follow
};