1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*
Quickplot - an interactive 2D plotter
Copyright (C) 1998-2011 Lance Arsenault
This file is part of Quickplot.
Quickplot is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
Quickplot is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quickplot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QP_SPEW_H_
#define _QP_SPEW_H_
#include <stdio.h>
extern
int qp_get_spew_level(void);
/* INFO 1 NOTICE 2 WARN 3 ERROR 4 NONE 5 */
extern
void qp_spew_init(int level);
extern
int qp_set_spew_level(int level);
/* This adds addition compiler checks for the printf formating. */
#define __printf(a,b) __attribute__((format(printf,a,b)))
extern
void qp_spew(int level, int show_errno, const char *format, ...)
__printf(3,4);
extern
void qp_spew_append(const char *format, ...)
__printf(1,2);
#define QP_INFO(fmt, ...) \
qp_spew(1, 0, fmt, ##__VA_ARGS__ )
#define QP_NOTICE(fmt, ...) \
qp_spew(2, 0, fmt, ##__VA_ARGS__ )
#define QP_WARN(fmt, ...) \
qp_spew(3, 0, fmt, ##__VA_ARGS__ )
#define QP_ERROR(fmt, ...) \
qp_spew(4, 0, fmt, ##__VA_ARGS__ )
#define QP_EINFO(fmt, ...) \
qp_spew(1, 1, fmt, ##__VA_ARGS__ )
#define QP_ENOTICE(fmt, ...) \
qp_spew(2, 1, fmt, ##__VA_ARGS__ )
#define QP_EWARN(fmt, ...) \
qp_spew(3, 1, fmt, ##__VA_ARGS__ )
#define QP_EERROR(fmt, ...) \
qp_spew(4, 1, fmt, ##__VA_ARGS__ )
#define QP_APPEND(fmt, ...) \
qp_spew_append(fmt, ##__VA_ARGS__ )
#else /* #ifndef _QP_SPEW_H_ */
#error "You included this file twice."
#endif /* #ifndef _QP_SPEW_H_ */
|