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