logging: Add assert when wrong backend is used
Add assert when logging v2 is enabled but backend doesn't support it. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
262cc55609
commit
aff9cfc65a
3 changed files with 7 additions and 3 deletions
|
@ -51,8 +51,8 @@ Logging v2 introduces following changes:
|
|||
- Logging backend API exteded with function for processing v2 messages.
|
||||
|
||||
.. note::
|
||||
Logging v1 is deprecated! Version 2 supports same set of features with listed
|
||||
above extensions. However, logging backend API is different. All backends in
|
||||
Logging v1 is deprecated! Version 2 supports same set of features with extensions
|
||||
listed above. However, logging backend API is different. All backends in
|
||||
the tree support version 2 API. Any custom backend must be adapted to version 2.
|
||||
Version 1 support will be removed after 3.1 release.
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ if(CONFIG_LOG2_MODE_IMMEDIATE OR CONFIG_LOG2_MODE_DEFERRED)
|
|||
endif()
|
||||
|
||||
if(CONFIG_LOG1)
|
||||
message(WARNING "Logging v1 has been deprecated. Use v2 and instead and adapt \
|
||||
message(WARNING "Logging v1 has been deprecated. Use v2 instead and adapt \
|
||||
custom backend to the new backend API"
|
||||
 )
|
||||
endif()
|
||||
|
|
|
@ -169,6 +169,10 @@ void log_backend_enable(struct log_backend const *const backend,
|
|||
|
||||
id += backend - log_backend_get(0);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_LOG1)) {
|
||||
__ASSERT(backend->api->process, "Backend does not support v2 API");
|
||||
}
|
||||
|
||||
log_backend_id_set(backend, id);
|
||||
backend_filter_set(backend, level);
|
||||
log_backend_activate(backend, ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue