| 1 |
/* |
| 2 |
* Copyright (C) 2009-2010 Felipe Contreras |
| 3 |
* |
| 4 |
* Author: Felipe Contreras <felipe.contreras@gmail.com> |
| 5 |
* |
| 6 |
* This file may be used under the terms of the GNU Lesser General Public |
| 7 |
* License version 2.1, a copy of which is found in LICENSE included in the |
| 8 |
* packaging of this file. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef LOG_H |
| 12 |
#define LOG_H |
| 13 |
|
| 14 |
/* #define DEBUG */ |
| 15 |
|
| 16 |
void pr_helper(unsigned int level, |
| 17 |
void *object, |
| 18 |
const char *file, |
| 19 |
const char *function, |
| 20 |
unsigned int line, |
| 21 |
const char *fmt, |
| 22 |
...) __attribute__((format(printf, 6, 7))); |
| 23 |
|
| 24 |
#define pr_base(level, object, ...) pr_helper(level, object, __FILE__, __func__, __LINE__, __VA_ARGS__) |
| 25 |
|
| 26 |
#define pr_err(object, ...) pr_base(0, object, __VA_ARGS__) |
| 27 |
#define pr_warning(object, ...) pr_base(1, object, __VA_ARGS__) |
| 28 |
#define pr_test(object, ...) pr_base(2, object, __VA_ARGS__) |
| 29 |
|
| 30 |
#if !defined(GST_DISABLE_GST_DEBUG) || defined(DEBUG) |
| 31 |
#define pr_info(object, ...) pr_base(3, object, __VA_ARGS__) |
| 32 |
#define pr_debug(object, ...) pr_base(4, object, __VA_ARGS__) |
| 33 |
#else |
| 34 |
#define pr_info(object, ...) ({ if (0) pr_base(3, object, __VA_ARGS__); }) |
| 35 |
#define pr_debug(object, ...) ({ if (0) pr_base(4, object, __VA_ARGS__); }) |
| 36 |
#endif |
| 37 |
|
| 38 |
#endif /* LOG_H */ |