Jens Axboe | 142575e | 2011-09-30 17:35:45 -0600 | [diff] [blame] | 1 | #include <unistd.h> |
| 2 | #include <fcntl.h> |
| 3 | #include <string.h> |
| 4 | #include <stdarg.h> |
| 5 | |
| 6 | #include "fio.h" |
| 7 | |
| 8 | int 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 Axboe | a781480 | 2011-09-30 22:20:37 -0600 | [diff] [blame] | 15 | len = vsnprintf(buffer, sizeof(buffer), format, args); |
Jens Axboe | 142575e | 2011-09-30 17:35:45 -0600 | [diff] [blame] | 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 | |
| 24 | int 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 Axboe | a781480 | 2011-09-30 22:20:37 -0600 | [diff] [blame] | 31 | len = vsnprintf(buffer, sizeof(buffer), format, args); |
Jens Axboe | 142575e | 2011-09-30 17:35:45 -0600 | [diff] [blame] | 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 | } |