logging: Add optional context argument to LOG_BACKEND_DEFINE
Extended LOG_BACKEND_DEFINE to support optional context argument. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
edc3c87c72
commit
d9518ce4cc
|
@ -76,10 +76,13 @@ extern const struct log_backend __log_backends_end[];
|
|||
* @param _api Logger backend API.
|
||||
* @param _autostart If true backend is initialized and activated together
|
||||
* with the logger subsystem.
|
||||
* @param ... Optional context.
|
||||
*/
|
||||
#define LOG_BACKEND_DEFINE(_name, _api, _autostart) \
|
||||
#define LOG_BACKEND_DEFINE(_name, _api, _autostart, ...) \
|
||||
static struct log_backend_control_block UTIL_CAT(backend_cb_, _name) = \
|
||||
{ \
|
||||
COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \
|
||||
(), (.ctx = __VA_ARGS__,)) \
|
||||
.id = 0, \
|
||||
.active = false, \
|
||||
}; \
|
||||
|
|
|
@ -592,7 +592,9 @@ void log_init(void)
|
|||
backend->api->init(backend);
|
||||
}
|
||||
|
||||
log_backend_enable(backend, NULL, CONFIG_LOG_MAX_LEVEL);
|
||||
log_backend_enable(backend,
|
||||
backend->cb->ctx,
|
||||
CONFIG_LOG_MAX_LEVEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue