From patchwork Wed Feb 3 18:17:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marian Cichy X-Patchwork-Id: 11125 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 16FB8BD160 for ; Wed, 3 Feb 2021 18:18:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A2B36844F; Wed, 3 Feb 2021 19:18:04 +0100 (CET) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC87468447 for ; Wed, 3 Feb 2021 19:18:03 +0100 (CET) Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7Mj5-0006HP-6q; Wed, 03 Feb 2021 19:18:03 +0100 Received: from mci by dude02.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1l7Mj3-0005k7-3G; Wed, 03 Feb 2021 19:18:01 +0100 From: Marian Cichy To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Feb 2021 19:17:46 +0100 Message-Id: <20210203181746.22028-1-m.cichy@pengutronix.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: mci@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH] libcamera: log: add colors to log levels X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marian Cichy Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" mono-colored wall of logs can be hard to read and doesn't show the level of failure at a first glance. By adding colors to the log level categories, it is much easier to scroll through logs and find important entries. Tested-by: Sebastian Fricke --- src/libcamera/log.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 45c7c2d2..3ad9c3de 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -85,11 +85,11 @@ static int log_severity_to_syslog(LogSeverity severity) static const char *log_severity_name(LogSeverity severity) { static const char *const names[] = { - "DEBUG", - " INFO", - " WARN", - "ERROR", - "FATAL", + "\033[1m\033[37mDEBUG\033[0m", + "\033[1m\033[32m INFO\033[0m", + "\033[1m\033[33m WARN\033[0m", + "\033[1m\033[31mERROR\033[0m", + "\033[1m\033[35mFATAL\033[0m", }; if (static_cast(severity) < std::size(names))