summaryrefslogtreecommitdiff
path: root/common/log_console.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-12-04 13:48:25 -0700
committerTom Rini <trini@konsulko.com>2017-12-07 15:17:00 -0500
commitc6d47535dfb6636ae5244958a2a9e043bb7646ae (patch)
treef3dc95306afb0214b4ac62b0ad6deef3882cc946 /common/log_console.c
parente9c8d49d54cbbc7b219a1637d2994de7448b767d (diff)
log: Add a console driver
It is useful to display log messages on the console. Add a simple driver to handle this. Note that this driver outputs to the console, which may be serial or video. It does not specifically select serial output. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'common/log_console.c')
-rw-r--r--common/log_console.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/log_console.c b/common/log_console.c
new file mode 100644
index 0000000000..5af73bd8be
--- /dev/null
+++ b/common/log_console.c
@@ -0,0 +1,23 @@
+/*
+ * Logging support
+ *
+ * Copyright (c) 2017 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <log.h>
+
+static int log_console_emit(struct log_device *ldev, struct log_rec *rec)
+{
+ puts(rec->msg);
+
+ return 0;
+}
+
+LOG_DRIVER(console) = {
+ .name = "console",
+ .emit = log_console_emit,
+};