1 /* 2 * Copyright (c) 2017 - 2023, Nordic Semiconductor ASA 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, this 11 * list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of the copyright holder nor the names of its 18 * contributors may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef NRFX_LOG_H__ 35 #define NRFX_LOG_H__ 36 37 // THIS IS A TEMPLATE FILE. 38 // It should be copied to a suitable location within the host environment into 39 // which nrfx is integrated, and the following macros should be provided with 40 // appropriate implementations. 41 // And this comment should be removed from the customized file. 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @defgroup nrfx_log nrfx_log.h 49 * @{ 50 * @ingroup nrfx 51 * 52 * @brief This file contains macros that should be implemented according to 53 * the needs of the host environment into which @em nrfx is integrated. 54 */ 55 56 /** 57 * @brief Macro for logging a message with the severity level ERROR. 58 * 59 * @param format printf-style format string, optionally followed by arguments 60 * to be formatted and inserted in the resulting string. 61 */ 62 #define NRFX_LOG_ERROR(format, ...) 63 64 /** 65 * @brief Macro for logging a message with the severity level WARNING. 66 * 67 * @param format printf-style format string, optionally followed by arguments 68 * to be formatted and inserted in the resulting string. 69 */ 70 #define NRFX_LOG_WARNING(format, ...) 71 72 /** 73 * @brief Macro for logging a message with the severity level INFO. 74 * 75 * @param format printf-style format string, optionally followed by arguments 76 * to be formatted and inserted in the resulting string. 77 */ 78 #define NRFX_LOG_INFO(format, ...) 79 80 /** 81 * @brief Macro for logging a message with the severity level DEBUG. 82 * 83 * @param format printf-style format string, optionally followed by arguments 84 * to be formatted and inserted in the resulting string. 85 */ 86 #define NRFX_LOG_DEBUG(format, ...) 87 88 89 /** 90 * @brief Macro for logging a memory dump with the severity level ERROR. 91 * 92 * @param[in] p_memory Pointer to the memory region to be dumped. 93 * @param[in] length Length of the memory region in bytes. 94 */ 95 #define NRFX_LOG_HEXDUMP_ERROR(p_memory, length) 96 97 /** 98 * @brief Macro for logging a memory dump with the severity level WARNING. 99 * 100 * @param[in] p_memory Pointer to the memory region to be dumped. 101 * @param[in] length Length of the memory region in bytes. 102 */ 103 #define NRFX_LOG_HEXDUMP_WARNING(p_memory, length) 104 105 /** 106 * @brief Macro for logging a memory dump with the severity level INFO. 107 * 108 * @param[in] p_memory Pointer to the memory region to be dumped. 109 * @param[in] length Length of the memory region in bytes. 110 */ 111 #define NRFX_LOG_HEXDUMP_INFO(p_memory, length) 112 113 /** 114 * @brief Macro for logging a memory dump with the severity level DEBUG. 115 * 116 * @param[in] p_memory Pointer to the memory region to be dumped. 117 * @param[in] length Length of the memory region in bytes. 118 */ 119 #define NRFX_LOG_HEXDUMP_DEBUG(p_memory, length) 120 121 122 /** 123 * @brief Macro for getting the textual representation of a given error code. 124 * 125 * @param[in] error_code Error code. 126 * 127 * @return String containing the textual representation of the error code. 128 */ 129 #define NRFX_LOG_ERROR_STRING_GET(error_code) 130 131 /** @} */ 132 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif // NRFX_LOG_H__ 138