logging: Add API to get log_backend instance by name.
Added helper API to the logging backend interface to get the log backend instance by name. Signed-off-by: Aastha Grover <aastha.grover@intel.com>
This commit is contained in:
parent
134c0c3562
commit
e4e675dc37
2 changed files with 22 additions and 0 deletions
|
@ -160,6 +160,19 @@ static void backend_filter_set(struct log_backend const *const backend,
|
|||
}
|
||||
}
|
||||
|
||||
const struct log_backend *log_backend_get_by_name(const char *backend_name)
|
||||
{
|
||||
const struct log_backend *ptr = __log_backends_start;
|
||||
|
||||
while (ptr < __log_backends_end) {
|
||||
if (strcmp(backend_name, ptr->name) == 0) {
|
||||
return ptr;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void log_backend_enable(struct log_backend const *const backend,
|
||||
void *ctx,
|
||||
uint32_t level)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue