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> |
c802cacb | 13 | |
4164020e SM |
14 | #define PERR(fmt, ...) \ |
15 | do { \ | |
16 | if (PRINT_ERR_STREAM) { \ | |
17 | fprintf(PRINT_ERR_STREAM, "Error: " PRINT_PREFIX ": " fmt, ##__VA_ARGS__); \ | |
18 | } \ | |
19 | } while (0) | |
e98a2d6e | 20 | |
4164020e SM |
21 | #define PWARN(fmt, ...) \ |
22 | do { \ | |
23 | if (PRINT_ERR_STREAM) { \ | |
24 | fprintf(PRINT_ERR_STREAM, "Warning: " PRINT_PREFIX ": " fmt, ##__VA_ARGS__); \ | |
25 | } \ | |
26 | } while (0) | |
e98a2d6e | 27 | |
4164020e SM |
28 | #define PDBG(fmt, ...) \ |
29 | do { \ | |
30 | if (babeltrace_debug) { \ | |
31 | fprintf(stderr, "Debug: " PRINT_PREFIX ": " fmt, ##__VA_ARGS__); \ | |
32 | } \ | |
33 | } while (0) | |
e98a2d6e PP |
34 | |
35 | #endif /* CTF_BTR_PRINT_H */ |