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