| 1 | /* |
| 2 | * Asterisk -- An open source telephony toolkit. |
| 3 | * |
| 4 | * Copyright (C) 2021, Sangoma Technologies Corporation |
| 5 | * |
| 6 | * Kevin Harwell <[email protected]> |
| 7 | * |
| 8 | * See http://www.asterisk.org for more information about |
| 9 | * the Asterisk project. Please do not directly contact |
| 10 | * any of the maintainers of this project for assistance; |
| 11 | * the project provides a web site, mailing lists and IRC |
| 12 | * channels for your use. |
| 13 | * |
| 14 | * This program is free software, distributed under the terms of |
| 15 | * the GNU General Public License Version 2. See the LICENSE file |
| 16 | * at the top of the source tree. |
| 17 | */ |
| 18 | |
| 19 | #ifndef RES_AEAP_LOGGER_H |
| 20 | #define RES_AEAP_LOGGER_H |
| 21 | |
| 22 | #include "asterisk.h" |
| 23 | |
| 24 | #include "asterisk/logger.h" |
| 25 | #include "asterisk/strings.h" |
| 26 | |
| 27 | /*! |
| 28 | * \brief Log an Asterisk external application message |
| 29 | * |
| 30 | * \param level The logging level |
| 31 | * \param obj The object being logged |
| 32 | * \param name Optional subsystem name |
| 33 | * \param fmt Format string |
| 34 | * \param ... Parameters for the format string |
| 35 | */ |
| 36 | #define aeap_log(level, obj, name, fmt, ...) \ |
| 37 | ast_log(level, "AEAP%s%s (%p): " fmt "\n", ast_strlen_zero(name) ? "" : " ", \ |
| 38 | ast_strlen_zero(name) ? "" : name, obj, ##__VA_ARGS__) |
| 39 | |
| 40 | /*! |
| 41 | * \brief Log an Asterisk external application error |
| 42 | * |
| 43 | * \param obj The object being logged |
| 44 | * \param name Optional subsystem name |
| 45 | * \param fmt Format string |
| 46 | * \param ... Parameters for the format string |
| 47 | */ |
| 48 | #define aeap_error(obj, name, fmt, ...) aeap_log(LOG_ERROR, obj, name, fmt, ##__VA_ARGS__) |
| 49 | |
| 50 | /*! |
| 51 | * \brief Log an Asterisk external application warning |
| 52 | * |
| 53 | * \param obj The object being logged |
| 54 | * \param name Optional subsystem name |
| 55 | * \param fmt Format string |
| 56 | * \param ... Parameters for the format string |
| 57 | */ |
| 58 | #define aeap_warn(obj, name, fmt, ...) aeap_log(LOG_WARNING, obj, name, fmt, ##__VA_ARGS__) |
| 59 | |
| 60 | #endif /* RES_AEAP_LOGGER_H */ |