Avoid subtraction on void pointers.
void* pointer arithmetic is not allowed by C standard and also C++.
If you include "logging/log.h" into a C++ application it fails to
build.
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Rather than having some implied name for the logging name, explicitly
pass it in the macros LOG_MODULE_REGISTER & LOG_MODULE_DECLARE.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
LOG_MODULE_REGISTER() was missing setting compiled-in log level
which was evaluated when message was filtered if runtime filtering
was disabled. As the outcome logs were not printed when runtime
filtering was disabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added macro trick which evaluates macro when used and not
when header file is included. After this change order of
defining LOG_LEVEL and including log.h is no longer fixed.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Moved declarations and macros which are used in log_core from
log_instance.h to log_core.h. Moved log level defines from
log.h to log_instance.h because log.h is not recommended to
be included in headers (contrary to log_instance.h).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
When log API is used it should give the same side effect when enabled
or disabled e.g. LOG_INF(%d,cnt++) should always increment cnt.
Before this change cnt would be incremented twice when log enabled
and never incremented when log was disabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
When log is locally disabled then structures associated with the module
are not created. Logger API macros were evaluating those structues even
when log was disabled for given module. That resulted in compilation
error. Macros has been improved to not touch those structures when
log is disabled for given module.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The macro parameters need to be protected by (), otherwise it
is possible to get this kind of warning
include/logging/log_core.h:214:6: note: expected
‘u32_t {aka unsigned int}’ but argument is of type ‘char *’
void log_3(const char *str,
This can happen for example if the macro parameter is not plain
variable. Example:
NET_DBG("Route %p nexthop %s", route,
nexthop ? net_sprint_ipv6_addr(nexthop) : "<unknown>");
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Adding new implementation of logging subsystem. New features
includes: support for multiple backends, improving performance
by deferring log processing to the known context, adding
timestamps and logs filtering options (compile time, runtime,
module level, instance level). Console backend added as the
example backend.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>