1 /* 2 * Copyright (c) 2018 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef EXT_LOG_SYSTEM_H 7 #define EXT_LOG_SYSTEM_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /** Log message priority levels */ 14 enum ext_log_level { 15 EXT_LOG_CRITICAL, 16 EXT_LOG_ERROR, 17 EXT_LOG_WARNING, 18 EXT_LOG_NOTICE, 19 EXT_LOG_INFO, 20 EXT_LOG_DEBUG 21 }; 22 23 /** Log message handler type. */ 24 typedef void (*ext_log_handler)(enum ext_log_level level, 25 const char *format, ...); 26 27 /** @brief Set log handler function. 28 * 29 * @param handler External log handler. 30 */ 31 void ext_log_handler_set(ext_log_handler handler); 32 33 /** @brief Example function which is using custom log API. */ 34 void ext_log_system_foo(void); 35 36 /** @brief Custom log API. */ 37 #define ext_log(level, ...) log_handler(level, __VA_ARGS__) 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 #endif /* EXT_LOG_SYSTEM_H */ 44