Server logging cleanup/functionality
[fio.git] / infolog.c
CommitLineData
142575e6
JA
1#include <unistd.h>
2#include <fcntl.h>
3#include <string.h>
4#include <stdarg.h>
5
6#include "fio.h"
7
8int log_info(const char *format, ...)
9{
10 char buffer[1024];
11 va_list args;
12 size_t len;
13
14 va_start(args, format);
15 len = vsprintf(buffer, format, args);
16 va_end(args);
17
18 if (is_backend)
19 return fio_server_text_output(buffer, len);
20 else
21 return fwrite(buffer, len, 1, f_out);
22}
23
24int log_err(const char *format, ...)
25{
26 char buffer[1024];
27 va_list args;
28 size_t len;
29
30 va_start(args, format);
31 len = vsprintf(buffer, format, args);
32 va_end(args);
33
34 if (is_backend)
35 return fio_server_text_output(buffer, len);
36 else
37 return fwrite(buffer, len, 1, f_err);
38}