| #include <stdio.h> |
| #include <stdarg.h> |
| #include "../minmax.h" |
| |
| int log_err(const char *format, ...) |
| { |
| char buffer[1024]; |
| va_list args; |
| size_t len; |
| |
| va_start(args, format); |
| len = vsnprintf(buffer, sizeof(buffer), format, args); |
| va_end(args); |
| len = min(len, sizeof(buffer) - 1); |
| |
| return fwrite(buffer, len, 1, stderr); |
| } |
| |
| int log_info(const char *format, ...) |
| { |
| char buffer[1024]; |
| va_list args; |
| size_t len; |
| |
| va_start(args, format); |
| len = vsnprintf(buffer, sizeof(buffer), format, args); |
| va_end(args); |
| len = min(len, sizeof(buffer) - 1); |
| |
| return fwrite(buffer, len, 1, stdout); |
| } |