From fe2656543d4d83139d239f6caabc09d1e68c2a72 Mon Sep 17 00:00:00 2001 From: Kevin Yang Date: Tue, 1 Mar 2016 14:42:31 -0800 Subject: [PATCH] update log_flush api to return # bytes flushed --- include/cc_log.h | 2 +- src/cc_log.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/cc_log.h b/include/cc_log.h index 8ef355d98..56eda540c 100644 --- a/include/cc_log.h +++ b/include/cc_log.h @@ -81,7 +81,7 @@ bool log_write(struct logger *logger, char *buf, uint32_t len); void _log_fd(int fd, const char *fmt, ...); -void log_flush(struct logger *logger); +size_t log_flush(struct logger *logger); #ifdef __cplusplus } diff --git a/src/cc_log.c b/src/cc_log.c index fad14162b..e34d58b16 100644 --- a/src/cc_log.c +++ b/src/cc_log.c @@ -275,7 +275,7 @@ _rbuf_flush(struct rbuf *buf, int fd) return ret; } -void +size_t log_flush(struct logger *logger) { ssize_t n; @@ -299,4 +299,6 @@ log_flush(struct logger *logger) } else { INCR(log_metrics, log_flush); } + + return n; }