a2f744e50f3d263f74b42068c28b07285018bee7
[babeltrace.git] / src / plugins / ctf / common / print.hpp
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, \
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 */
This page took 0.029945 seconds and 3 git commands to generate.