logging: Cleanup in the internal headers

Added log_internal.h for internal APIs. Move functions out of
log_core.h. Log_core.h shall have only macros and functions related
to logging message creation. Log_core.h is included by log.h thus
number of dependencies in that headers must be limited to minimum
to allow including without risk of circular dependencies.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-09-14 15:32:57 +02:00 committed by Christopher Friedt
commit 03165c914b
12 changed files with 161 additions and 169 deletions

View file

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <logging/log_core.h>
#include <logging/log_internal.h>
#include <logging/log_ctrl.h>
#include <syscall_handler.h>
@ -12,6 +12,16 @@
* - controlling backends filtering
*/
/** @brief Get compiled level of the log source.
*
* @param source_id Source ID.
* @return Level.
*/
static inline uint8_t log_compiled_level_get(uint32_t source_id)
{
return __log_const_start[source_id].level;
}
void z_log_runtime_filters_init(void)
{
/*
@ -38,6 +48,16 @@ uint32_t log_src_cnt_get(uint32_t domain_id)
return log_sources_count();
}
/** @brief Get name of the log source.
*
* @param source_id Source ID.
* @return Name.
*/
static inline const char *log_name_get(uint32_t source_id)
{
return __log_const_start[source_id].name;
}
const char *log_source_name_get(uint32_t domain_id, uint32_t src_id)
{
return src_id < log_sources_count() ? log_name_get(src_id) : NULL;