aboutsummaryrefslogtreecommitdiff
path: root/common/log.c
diff options
context:
space:
mode:
authorSimon Glass2020-09-12 12:28:47 -0600
committerTom Rini2020-10-10 16:50:11 -0400
commitb45203004ec3f3e5a259e68eddb3eb572d37f56d (patch)
treeb43d3a931abfa4e558aca75872952402f0a8adfb /common/log.c
parent26637e2e4c7235e4fe01b78a9646471c65e28aea (diff)
log: Add a flag to enable log drivers
At present there is no way to disable a log driver. But the syslog driver causes (attempted) network traffic in sandbox every time a log message is printed, which is often. Add a flag to enable a log driver. Adjust struct log_device to use a short for next_filter_num so that no more memory is used for devices. Also fix a missing line in the struct log_driver comment while here. To maintain compatibility, enable it for all drivers for now. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/log.c')
-rw-r--r--common/log.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/log.c b/common/log.c
index ac34f1c97b9..d6dfabb09a6 100644
--- a/common/log.c
+++ b/common/log.c
@@ -207,7 +207,8 @@ static int log_dispatch(struct log_rec *rec)
/* Emit message */
processing_msg = 1;
list_for_each_entry(ldev, &gd->log_head, sibling_node) {
- if (log_passes_filters(ldev, rec))
+ if ((ldev->flags & LOGDF_ENABLE) &&
+ log_passes_filters(ldev, rec))
ldev->drv->emit(ldev, rec);
}
processing_msg = 0;
@@ -329,6 +330,7 @@ int log_init(void)
}
INIT_LIST_HEAD(&ldev->filter_head);
ldev->drv = drv;
+ ldev->flags = drv->flags;
list_add_tail(&ldev->sibling_node,
(struct list_head *)&gd->log_head);
drv++;