summaryrefslogtreecommitdiff
path: root/src/core/log.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-10 05:54:35 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-10 05:54:35 +0000
commit88b091cc95b346da50d21ba2526c76d760ad97fa (patch)
tree399450424a0cef5abf985fd4d271edd557a448a8 /src/core/log.c
parent5061783f4ce035b2c432fa1b3a45f9213989a45a (diff)
downloadirssi-88b091cc95b346da50d21ba2526c76d760ad97fa.zip
Write buffer - logs and rawlogs write to files through this. By default
everything gets written immediately, but you can make it wait until there's specified amount of data in buffer or write once in a hour or so. Useful for people who want to keep hard disk at sleep at nights but still want to log. /SET write_buffer_mins, /SET write_buffer_kb: When to flush buffer. /FLUSHBUFFER: Flush the buffer immediately git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1201 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/log.c')
-rw-r--r--src/core/log.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/log.c b/src/core/log.c
index 55e0c5f6..58d95b1d 100644
--- a/src/core/log.c
+++ b/src/core/log.c
@@ -25,6 +25,7 @@
#include "misc.h"
#include "servers.h"
#include "log.h"
+#include "write-buffer.h"
#include "lib-config/iconfig.h"
#include "settings.h"
@@ -71,8 +72,8 @@ static void log_write_timestamp(int handle, const char *format,
tm = localtime(&stamp);
if (strftime(str, sizeof(str), format, tm) > 0) {
- write(handle, str, strlen(str));
- if (suffix != NULL) write(handle, suffix, strlen(suffix));
+ write_buffer(handle, str, strlen(str));
+ if (suffix != NULL) write_buffer(handle, suffix, strlen(suffix));
}
}
@@ -158,6 +159,7 @@ void log_stop_logging(LOG_REC *log)
fcntl(log->handle, F_SETLK, &lock);
#endif
+ write_buffer_flush();
close(log->handle);
log->handle = -1;
}
@@ -214,7 +216,7 @@ void log_write_rec(LOG_REC *log, const char *str)
log->last = now;
log_write_timestamp(log->handle, log_timestamp, str, now);
- write(log->handle, "\n", 1);
+ write_buffer(log->handle, "\n", 1);
signal_emit("log written", 2, log, str);
}