Changed LOG_MODULE_REGISTER and LOG_MODULE_DECLARE macros to take log level as optional parameter. LOG_MODULE_DECLARE can now also be used in static inline functions in headers. Added LOG_LEVEL_SET macro which is used when instance logging API is used to indicate maximal log level compiled into the file. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
25 lines
606 B
C
25 lines
606 B
C
/*
|
|
* Copyright (c) 2018 Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include "sample_instance.h"
|
|
#include <string.h>
|
|
|
|
/* Note: no name is defined because only instance logging is used.
|
|
* Instances are registered as logging sources not module.
|
|
*/
|
|
#include <logging/log.h>
|
|
|
|
LOG_LEVEL_SET(LOG_LEVEL_INF);
|
|
|
|
void sample_instance_call(struct sample_instance *inst)
|
|
{
|
|
u8_t data[4] = { 1, 2, 3, 4 };
|
|
|
|
LOG_INST_INF(inst->log, "counter_value: %d", inst->cnt++);
|
|
LOG_INST_HEXDUMP_WRN(inst->log, data, sizeof(data),
|
|
"Example of hexdump:");
|
|
(void)memset(data, 0, sizeof(data));
|
|
}
|