blob: b7b4a5e941db903fb4b83a66c49d8a64c7d375a1 [file] [log] [blame]
Jens Axboe142575e2011-09-30 17:35:45 -06001#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);
Jens Axboea7814802011-09-30 22:20:37 -060015 len = vsnprintf(buffer, sizeof(buffer), format, args);
Jens Axboe142575e2011-09-30 17:35:45 -060016 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);
Jens Axboea7814802011-09-30 22:20:37 -060031 len = vsnprintf(buffer, sizeof(buffer), format, args);
Jens Axboe142575e2011-09-30 17:35:45 -060032 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}