Patch Detail
Show a patch.
GET /api/patches/15610/?format=api
{ "id": 15610, "url": "https://patchwork.libcamera.org/api/patches/15610/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15610/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220401090309.2704921-1-kieran.bingham@ideasonboard.com>", "date": "2022-04-01T09:03:09", "name": "[libcamera-devel] libcamera: base: log: Use emoji's in log output", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": false, "hash": "24df6ecf11cb4911529464a0dbd61019a6563da0", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15610/mbox/", "series": [ { "id": 3024, "url": "https://patchwork.libcamera.org/api/series/3024/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3024", "date": "2022-04-01T09:03:09", "name": "[libcamera-devel] libcamera: base: log: Use emoji's in log output", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3024/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15610/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15610/checks/", "tags": {}, "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 0194AC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 1 Apr 2022 09:03:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5436A633A5;\n\tFri, 1 Apr 2022 11:03:15 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A86A604B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 1 Apr 2022 11:03:13 +0200 (CEST)", "from Monstersaurus.local\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 0924B486;\n\tFri, 1 Apr 2022 11:03:12 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648803795;\n\tbh=s7zWsB4hIYlYqBlFxjWym9iaezZU1/zL5w6m496pYmc=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=I4cmm1PMjA1HiNIUOw7h70DpX3/mCQ7+oCNivJ8yFrWR09DNCholk44CTZC99Wpq9\n\tRVfSw6RFTIDs04HlHfRLdOPAntBYZ1QwqUB8ux8iTHHiRSjorI6ohTJ+wIMcFO7xE2\n\tZrNjHhotWLrpTmOSe3hFNVSZUkL/Z0o+kRmPW/UavnhjyciVvaP6ZesbZo/AeeYhOk\n\toWa9+3IAXIgii1UwMd1z/aY2l1oXg12VkqXXabHm5G2xYM+MlmWjGguYfp3zwuNH5l\n\trulCv/yTeTyidugw38xZtHBbmvN/gutEzk5RHld5BwKL9B1ki5XAfCpEZwPc6sI19P\n\tmNuJdjGF2dQvw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648803793;\n\tbh=s7zWsB4hIYlYqBlFxjWym9iaezZU1/zL5w6m496pYmc=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=iD3jDT5VUR+g+FUMauYA9VlV0GC1KyDgDIqUag59xqMKe94vgQoK3vtII5lWOeAds\n\tRMXF7f23xAxGdLprWVOjul12LaRLWul1kt7vFRJLhzzxwmhul5RQsjClW38CZRuoTF\n\tutlcIZRHzVOh4Hbi519BsxpnV9H6MWBMlSeWyAZU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"iD3jDT5V\"; dkim-atps=neutral", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Fri, 1 Apr 2022 10:03:09 +0100", "Message-Id": "<20220401090309.2704921-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: base: log: Use emoji's in log\n\toutput", "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>" }, "content": "Our debug logs are already growing terse and difficult to parse with the\neye. The specific notifications can easily blend into each other.\n\nAdd some highlight and colour to the log messages by replacing\nthe log severity levels with emoji characters which convey\nthe same meaning but in much less space.\n\nSyslog and output to files remains unchanged. Only stream outputs\ndisplay emoji symbols.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/base/log.cpp | 25 ++++++++++++++++++++++++-\n 1 file changed, 24 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\nindex 64813b6607c5..aceec7302549 100644\n--- a/src/libcamera/base/log.cpp\n+++ b/src/libcamera/base/log.cpp\n@@ -96,6 +96,23 @@ static const char *log_severity_name(LogSeverity severity)\n \t\treturn \"UNKWN\";\n }\n \n+static const std::string &log_severity_emojis(LogSeverity severity)\n+{\n+\tstatic const std::string emojis[] = {\n+\t\t\"đǞ \", // DEBUG\n+\t\t\"âšī¸ \", // INFO\n+\t\t\"â ī¸ \", // WARNING\n+\t\t\"đĨ \", // ERROR\n+\t\t\"đ \", // FATAL\n+\t\t\"đ¤ \", // Unknown\n+\t};\n+\n+\tif (static_cast<unsigned int>(severity) < std::size(emojis))\n+\t\treturn emojis[severity];\n+\telse\n+\t\treturn emojis[std::size(emojis) - 1];\n+}\n+\n /**\n * \\brief Log output\n *\n@@ -194,7 +211,6 @@ void LogOutput::write(const LogMessage &msg)\n \t\t + msg.msg();\n \t\twriteSyslog(msg.severity(), str);\n \t\tbreak;\n-\tcase LoggingTargetStream:\n \tcase LoggingTargetFile:\n \t\tstr = \"[\" + utils::time_point_to_string(msg.timestamp()) + \"] [\"\n \t\t + std::to_string(Thread::currentId()) + \"] \"\n@@ -203,6 +219,13 @@ void LogOutput::write(const LogMessage &msg)\n \t\t + msg.msg();\n \t\twriteStream(str);\n \t\tbreak;\n+\tcase LoggingTargetStream:\n+\t\tstr = \"[\" + utils::time_point_to_string(msg.timestamp()) + \"] [\"\n+\t\t + std::to_string(Thread::currentId()) + \"] \"\n+\t\t + log_severity_emojis(msg.severity()) + \" \"\n+\t\t + msg.category().name() + \" \" + msg.fileInfo() + \" \"\n+\t\t + msg.msg();\n+\t\twriteStream(str);\n \tdefault:\n \t\tbreak;\n \t}\n", "prefixes": [ "libcamera-devel" ] }