Commit | Line | Data |
---|---|---|
e98a2d6e | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
e98a2d6e PP |
3 | * |
4 | * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com> | |
5 | * | |
0235b0db | 6 | * Define PRINT_PREFIX and PRINT_ERR_STREAM, then include this file. |
e98a2d6e PP |
7 | */ |
8 | ||
0235b0db MJ |
9 | #ifndef CTF_BTR_PRINT_H |
10 | #define CTF_BTR_PRINT_H | |
11 | ||
e98a2d6e | 12 | #include <stdio.h> |
91d81473 | 13 | #include "common/macros.h" |
e98a2d6e PP |
14 | |
15 | #define PERR(fmt, ...) \ | |
16 | do { \ | |
17 | if (PRINT_ERR_STREAM) { \ | |
18 | fprintf(PRINT_ERR_STREAM, \ | |
19 | "Error: " PRINT_PREFIX ": " fmt, \ | |
20 | ##__VA_ARGS__); \ | |
21 | } \ | |
22 | } while (0) | |
23 | ||
24 | #define PWARN(fmt, ...) \ | |
25 | do { \ | |
26 | if (PRINT_ERR_STREAM) { \ | |
27 | fprintf(PRINT_ERR_STREAM, \ | |
28 | "Warning: " PRINT_PREFIX ": " fmt, \ | |
29 | ##__VA_ARGS__); \ | |
30 | } \ | |
31 | } while (0) | |
32 | ||
33 | #define PDBG(fmt, ...) \ | |
34 | do { \ | |
35 | if (babeltrace_debug) { \ | |
36 | fprintf(stderr, \ | |
37 | "Debug: " PRINT_PREFIX ": " fmt, \ | |
38 | ##__VA_ARGS__); \ | |
39 | } \ | |
40 | } while (0) | |
41 | ||
42 | #endif /* CTF_BTR_PRINT_H */ |