log: fix signedness issue
[fio.git] / log.h
CommitLineData
a3d741fa
JA
1#ifndef FIO_LOG_H
2#define FIO_LOG_H
3
bf84eacb 4#include <stdio.h>
ecd6cc10 5#include <stdarg.h>
bf84eacb 6
a666cab8
JA
7#include "lib/output_buffer.h"
8
a3d741fa
JA
9extern FILE *f_out;
10extern FILE *f_err;
11
34a3a855
JA
12extern ssize_t log_err(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
13extern ssize_t log_info(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
5768cc2b
JA
14extern size_t __log_buf(struct buf_output *, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
15extern size_t log_valist(const char *str, va_list);
e5f9a813 16extern void log_prevalist(int type, const char *str, va_list);
830814d4 17extern size_t log_info_buf(const char *buf, size_t len);
fdd5f15f 18extern int log_info_flush(void);
a3d741fa 19
c8a07f87
JA
20#define log_buf(buf, format, args...) \
21({ \
22 size_t __ret; \
23 if ((buf) != NULL) \
24 __ret = __log_buf(buf, format, ##args); \
25 else \
26 __ret = log_info(format, ##args); \
27 __ret; \
28})
a666cab8 29
084d1c6f
JA
30enum {
31 FIO_LOG_DEBUG = 1,
32 FIO_LOG_INFO = 2,
33 FIO_LOG_ERR = 3,
3ad04399 34 FIO_LOG_NR = 4,
084d1c6f
JA
35};
36
3ad04399
JA
37extern const char *log_get_level(int level);
38
a3d741fa 39#endif