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