Merge branch 'evelu-peak' of https://github.com/ErwanAliasr1/fio
[fio.git] / t / log.c
CommitLineData
0cda2d50
JA
1#include <stdio.h>
2#include <stdarg.h>
d6b18e27 3#include "../minmax.h"
0cda2d50 4
d1f20a39 5size_t log_err(const char *format, ...)
0cda2d50
JA
6{
7 char buffer[1024];
8 va_list args;
9 size_t len;
10
11 va_start(args, format);
12 len = vsnprintf(buffer, sizeof(buffer), format, args);
13 va_end(args);
98ffb8f3 14 len = min(len, sizeof(buffer) - 1);
0cda2d50
JA
15
16 return fwrite(buffer, len, 1, stderr);
17}
6ff38856 18
d1f20a39 19size_t log_info(const char *format, ...)
6ff38856
JA
20{
21 char buffer[1024];
22 va_list args;
23 size_t len;
24
25 va_start(args, format);
26 len = vsnprintf(buffer, sizeof(buffer), format, args);
27 va_end(args);
98ffb8f3 28 len = min(len, sizeof(buffer) - 1);
6ff38856
JA
29
30 return fwrite(buffer, len, 1, stdout);
31}