From c6d47535dfb6636ae5244958a2a9e043bb7646ae Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 4 Dec 2017 13:48:25 -0700 Subject: 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 Reviewed-by: Bin Meng --- common/log_console.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common/log_console.c (limited to 'common/log_console.c') 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 + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +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, +}; -- cgit v1.2.3