]> git.ipfire.org Git - thirdparty/nqptp.git/blame - debug.h
Merge pull request #34 from heitbaum/patch-1
[thirdparty/nqptp.git] / debug.h
CommitLineData
bfe507fe
MB
1/*
2 * This file is part of the nqptp distribution (https://github.com/mikebrady/nqptp).
3 * Copyright (c) 2021 Mike Brady.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Commercial licensing is also available.
18 */
19
20// four level debug message utility giving file and line, total elapsed time, interval time
21// warn / inform / debug / die calls.
ff11595b
MB
22
23// level 0 is no messages, level 3 is most messages
24void debug_init(int level, int show_elapsed_time, int show_relative_time, int show_file_and_line);
25
26void _die(const char *filename, const int linenumber, const char *format, ...);
27void _warn(const char *filename, const int linenumber, const char *format, ...);
28void _inform(const char *filename, const int linenumber, const char *format, ...);
29void _debug(const char *filename, const int linenumber, int level, const char *format, ...);
30
31#define die(...) _die(__FILE__, __LINE__, __VA_ARGS__)
32#define debug(...) _debug(__FILE__, __LINE__, __VA_ARGS__)
33#define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
34#define inform(...) _inform(__FILE__, __LINE__, __VA_ARGS__)