Show a patch.

GET /api/patches/164/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 164,
    "url": "https://patchwork.libcamera.org/api/patches/164/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/164/",
    "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": "<20190107231151.23291-2-laurent.pinchart@ideasonboard.com>",
    "date": "2019-01-07T23:11:41",
    "name": "[libcamera-devel,v2,01/11] libcamera: log: Add a LogFatal log level",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f0964091f7101578b45888b5fbd4e940ece895fa",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/164/mbox/",
    "series": [
        {
            "id": 56,
            "url": "https://patchwork.libcamera.org/api/series/56/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=56",
            "date": "2019-01-07T23:11:40",
            "name": "libcamera: Add event notification and timers",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/56/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/164/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/164/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 D5AE760B2F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jan 2019 00:10:47 +0100 (CET)",
            "from avalon.bb.dnainternet.fi\n\t(dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D85AE4E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jan 2019 00:10:47 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1546902647;\n\tbh=kNEiHO6mGEMjpYrC1VfFDRa+lwkG3MBWL+XDWZWxNGE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Nl3sQA4TgTJ4+sHM67EYvJ5Xqfj4Vax8QPw49XMLzHRElLc3q+tWKES/SIm6pHsEg\n\t8ZrpSLhPaWuDyzKxlQHbqiq8gt5L5oRI/9ZcMJtCH4rpIblDokz9WqyEI3A9aEXCys\n\tE/P9A/Kn0xCD/LezngyCwujsvS/HQ5aR8IlcZBuI=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  8 Jan 2019 01:11:41 +0200",
        "Message-Id": "<20190107231151.23291-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20190107231151.23291-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190107231151.23291-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 01/11] libcamera: log: Add a LogFatal\n\tlog level",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Mon, 07 Jan 2019 23:10:48 -0000"
    },
    "content": "The LogFatal log level is similar to the LogError level, but\nadditionally abort program execution. This is useful to implement\nassertion handlers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/include/log.h |  2 ++\n src/libcamera/log.cpp       | 19 +++++++++++++++----\n 2 files changed, 17 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h\nindex 74439848c6ca..03842be02d0e 100644\n--- a/src/libcamera/include/log.h\n+++ b/src/libcamera/include/log.h\n@@ -16,6 +16,7 @@ enum LogSeverity {\n \tLogInfo,\n \tLogWarning,\n \tLogError,\n+\tLogFatal,\n };\n \n class LogMessage\n@@ -30,6 +31,7 @@ public:\n \n private:\n \tstd::ostringstream msgStream;\n+\tLogSeverity severity_;\n };\n \n #define LOG(severity) LogMessage(__FILE__, __LINE__, Log##severity).stream()\ndiff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp\nindex 44b3a5bbe279..a5823c64eaa6 100644\n--- a/src/libcamera/log.cpp\n+++ b/src/libcamera/log.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <cstdio>\n+#include <cstdlib>\n #include <ctime>\n #include <iomanip>\n #include <string.h>\n@@ -31,6 +32,8 @@ namespace libcamera {\n  * Warning message, signals a potential issue\n  * \\var LogError\n  * Error message, signals an unrecoverable issue\n+ * \\var LogFatal\n+ * Fatal message, signals an unrecoverable issue and aborts execution\n  */\n \n /**\n@@ -40,15 +43,19 @@ namespace libcamera {\n  * Return an std::ostream reference to which a message can be logged using the\n  * iostream API. The \\a severity controls whether the message is printed or\n  * dropped, depending on the global log level.\n+ *\n+ * If the severity is set to Fatal, execution is aborted and the program\n+ * terminates immediately after printing the message.\n  */\n \n static const char *log_severity_name(LogSeverity severity)\n {\n \tstatic const char * const names[] = {\n-\t\t\" DBG\",\n-\t\t\"INFO\",\n-\t\t\"WARN\",\n-\t\t\" ERR\",\n+\t\t\"  DBG\",\n+\t\t\" INFO\",\n+\t\t\" WARN\",\n+\t\t\"  ERR\",\n+\t\t\"FATAL\",\n \t};\n \n \tif (static_cast<unsigned int>(severity) < ARRAY_SIZE(names))\n@@ -73,6 +80,7 @@ static const char *log_severity_name(LogSeverity severity)\n  */\n LogMessage::LogMessage(const char *fileName, unsigned int line,\n \t\t       LogSeverity severity)\n+\t: severity_(severity)\n {\n \t/* Log the timestamp, severity and file information. */\n \tstruct timespec timestamp;\n@@ -93,6 +101,9 @@ LogMessage::~LogMessage()\n \tstd::string msg(msgStream.str());\n \tfwrite(msg.data(), msg.size(), 1, stderr);\n \tfflush(stderr);\n+\n+\tif (severity_ == LogSeverity::LogFatal)\n+\t\tstd::abort();\n }\n \n /**\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "01/11"
    ]
}