[{"id":23342,"web_url":"https://patchwork.libcamera.org/comment/23342/","msgid":"<165451711974.3884725.942129975991380909@Monstersaurus>","date":"2022-06-06T12:05:19","subject":"Re: [libcamera-devel] [PATCH v2 0/2] libcamera: Add colors to the\n\tlog","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-06-02 08:34:03)\n> Hello,\n> \n> This patch series addresses a shortcoming of libcamera compared to\n> GStreamer or PipeWire, namely colored logs.\n> \n> This was attempted by Marco Felsch in \"[PATCH] libcamera: log: add\n> colors to log levels\" but suffered from coloring message\n> unconditionally for streams, regardless of whether the stream was backed\n> by a TTY, a file or something else.\n> \n> This turned out impossible to solve automatically (as far as I can tell)\n> as the C++ stream API doesn't expose the underlying file descriptor.\n> I've thus taken another approach, by exposing coloring through the\n> libcamera logger API and only enabling it automatically when logging to\n> std::cerr. This can be disabled with the new LIBCAMERA_LOG_NO_COLOR\n> environment variable.\n> \n> Compared to v1, the first 3 patch have already been merged and are thus\n> not included in this version. The most notable other change is in patch\n> 1/2, where the escape codes used for bright colors have changed to work\n> with minicom.\n\nAha, interesting - so there are terminal specific requirements. I'm sure\nwe'll learn more when it's in use too, but I like this, and I think it\nhelps readability for parsing the logs. I know there will be those who\nfind color schemes more difficult to parse, or who have color blind\nrequirements, but the env flag can disable for that.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Laurent Pinchart (2):\n>   libcamera: base: log: Add coloring to the log output\n>   libcamera: base: log: Color the log prefix\n> \n>  Documentation/environment_variables.rst |  21 +++-\n>  include/libcamera/base/log.h            |   5 +-\n>  include/libcamera/logging.h             |   4 +-\n>  src/libcamera/base/log.cpp              | 144 ++++++++++++++++++------\n>  4 files changed, 131 insertions(+), 43 deletions(-)\n> \n> \n> base-commit: dfcf638a0a6d26dbfab5348e646e5cb3c45ec51e\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A6DA2BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jun 2022 12:05:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E529665635;\n\tMon,  6 Jun 2022 14:05:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F7AF633A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jun 2022 14:05:22 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD5CA30A;\n\tMon,  6 Jun 2022 14:05:21 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654517124;\n\tbh=AOmjPJH1xt3lDkZl6NuqAsPJ5qtrB5ODNMQrYZRBOcM=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=DwvlrzzKXMlco95CY00VS1nai/OI1TV9B+WsNjNbw9985syp+sHwe1AwZK0uFlTCn\n\tIKfSkQ5dioNnzih2lA7vH5N3XowvzNEuY5c/N8Q7IlEFO2oa5hPBOSVvuDKlI+bGMo\n\t5iXhVE3Lchn7PACR7JcSkmPeUZL/1Yt90+UcTik2LkPU+owm3iOhHzZDKlCgzKbSQa\n\tfXGhfGB36LqIyho7t3JRpqUQXsQh1rbH2wUxza9PpXNdIN57zD/L4jZCt0b4icSRfb\n\tgKyhWjO3EupC0HkZz0xT+D99ppt8jJkkV+JAbODDsLJuT/DpWKcZPV2aujnwrUUdoJ\n\tOBo91qmevVcuA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654517121;\n\tbh=AOmjPJH1xt3lDkZl6NuqAsPJ5qtrB5ODNMQrYZRBOcM=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=KSZkZOFFJZ+OoQ6jjZCL6CkSjWM38bAKa96TTh+13Ta+yj344TBjpvYCmsSjsCISW\n\tfxMAX0FEx7H+T6F31KTwqVH/LWb9+G5cu6kzye0Bm1/oyj/HhRMvA/x6rVDxHIj9x9\n\tw1JEZYRvHqjoKMamvLnhju8JGC1jfnmtFgLWi22k="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"KSZkZOFF\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220602073405.28168-1-laurent.pinchart@ideasonboard.com>","References":"<20220602073405.28168-1-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 06 Jun 2022 13:05:19 +0100","Message-ID":"<165451711974.3884725.942129975991380909@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 0/2] libcamera: Add colors to the\n\tlog","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]