Patch Detail
Show a patch.
GET /api/patches/1797/?format=api
{ "id": 1797, "url": "https://patchwork.libcamera.org/api/patches/1797/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1797/", "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": "<20190812124919.736-1-jacopo@jmondi.org>", "date": "2019-08-12T12:49:19", "name": "[libcamera-devel] libcamera: log: Print the function name in log", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0ef1801b423f7fd35e528ab1ca5134dbea4bf602", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/1797/mbox/", "series": [ { "id": 456, "url": "https://patchwork.libcamera.org/api/series/456/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=456", "date": "2019-08-12T12:49:19", "name": "[libcamera-devel] libcamera: log: Print the function name in log", "version": 1, "mbox": "https://patchwork.libcamera.org/series/456/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1797/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1797/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1EBDE6161B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:48:00 +0200 (CEST)", "from uno.homenet.telecomitalia.it\n\t(host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 6471D240006;\n\tMon, 12 Aug 2019 12:47:59 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 12 Aug 2019 14:49:19 +0200", "Message-Id": "<20190812124919.736-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.22.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: log: Print the function name\n\tin log", "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, 12 Aug 2019 12:48:00 -0000" }, "content": "Add the function name to the log tag.\n\nWith this patch applied, the log format looks like:\nINFO Camera camera_manager.cpp - start():83 libcamera v0.0.0+655-ddf32590\n\nCompared to:\nINFO Camera camera_manager.cpp:83 libcamera v0.0.0+654-a6799dc5\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/log.h | 19 +++++++++---------\n src/libcamera/log.cpp | 40 ++++++++++++++++++++++---------------\n 2 files changed, 34 insertions(+), 25 deletions(-)", "diff": "diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h\nindex 9b203f97e304..e65d20af1ca9 100644\n--- a/src/libcamera/include/log.h\n+++ b/src/libcamera/include/log.h\n@@ -50,9 +50,9 @@ const LogCategory &_LOG_CATEGORY(name)()\t\t\t\t\\\n class LogMessage\n {\n public:\n-\tLogMessage(const char *fileName, unsigned int line,\n+\tLogMessage(const char *fileName, const char *func, unsigned int line,\n \t\t LogSeverity severity);\n-\tLogMessage(const char *fileName, unsigned int line,\n+\tLogMessage(const char *fileName, const char *func, unsigned int line,\n \t\t const LogCategory &category, LogSeverity severity);\n \tLogMessage(const LogMessage &) = delete;\n \tLogMessage(LogMessage &&);\n@@ -67,7 +67,7 @@ public:\n \tconst std::string msg() const { return msgStream_.str(); }\n \n private:\n-\tvoid init(const char *fileName, unsigned int line);\n+\tvoid init(const char *fileName, const char* func, unsigned int line);\n \n \tstd::ostringstream msgStream_;\n \tconst LogCategory &category_;\n@@ -84,24 +84,25 @@ public:\n protected:\n \tvirtual std::string logPrefix() const = 0;\n \n-\tLogMessage _log(const char *file, unsigned int line,\n+\tLogMessage _log(const char *file, const char *func, unsigned int line,\n \t\t\tLogSeverity severity) const;\n-\tLogMessage _log(const char *file, unsigned int line,\n+\tLogMessage _log(const char *file, const char *func, unsigned int line,\n \t\t\tconst LogCategory &category,\n \t\t\tLogSeverity severity) const;\n };\n \n-LogMessage _log(const char *file, unsigned int line, LogSeverity severity);\n-LogMessage _log(const char *file, unsigned int line,\n+LogMessage _log(const char *file, const char *func, unsigned int line,\n+\t\tLogSeverity severity);\n+LogMessage _log(const char *file, const char *func, unsigned int line,\n \t\tconst LogCategory &category, LogSeverity severity);\n \n #ifndef __DOXYGEN__\n #define _LOG_CATEGORY(name) logCategory##name\n \n #define _LOG1(severity) \\\n-\t_log(__FILE__, __LINE__, Log##severity).stream()\n+\t_log(__FILE__, __func__, __LINE__, Log##severity).stream()\n #define _LOG2(category, severity) \\\n-\t_log(__FILE__, __LINE__, _LOG_CATEGORY(category)(), Log##severity).stream()\n+\t_log(__FILE__, __func__, __LINE__, _LOG_CATEGORY(category)(), Log##severity).stream()\n \n /*\n * Expand the LOG() macro to _LOG1() or _LOG2() based on the number of\ndiff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp\nindex 91f7c3ee5157..fa9a16452f25 100644\n--- a/src/libcamera/log.cpp\n+++ b/src/libcamera/log.cpp\n@@ -720,6 +720,7 @@ const LogCategory &LogCategory::defaultCategory()\n /**\n * \\brief Construct a log message for the default category\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] severity The log message severity, controlling how the message\n * will be displayed\n@@ -728,16 +729,17 @@ const LogCategory &LogCategory::defaultCategory()\n * \\a severity argument sets the message severity to control whether it will be\n * output or dropped.\n */\n-LogMessage::LogMessage(const char *fileName, unsigned int line,\n+LogMessage::LogMessage(const char *fileName, const char *func ,unsigned int line,\n \t\t LogSeverity severity)\n \t: category_(LogCategory::defaultCategory()), severity_(severity)\n {\n-\tinit(fileName, line);\n+\tinit(fileName, func, line);\n }\n \n /**\n * \\brief Construct a log message for a given category\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] category The log message category, controlling how the message\n * will be displayed\n@@ -748,11 +750,11 @@ LogMessage::LogMessage(const char *fileName, unsigned int line,\n * \\a severity argument sets the message severity to control whether it will be\n * output or dropped.\n */\n-LogMessage::LogMessage(const char *fileName, unsigned int line,\n+LogMessage::LogMessage(const char *fileName, const char *func, unsigned int line,\n \t\t const LogCategory &category, LogSeverity severity)\n \t: category_(category), severity_(severity)\n {\n-\tinit(fileName, line);\n+\tinit(fileName, func, line);\n }\n \n /**\n@@ -774,13 +776,14 @@ LogMessage::LogMessage(LogMessage &&other)\n \tother.severity_ = LogInvalid;\n }\n \n-void LogMessage::init(const char *fileName, unsigned int line)\n+void LogMessage::init(const char *fileName, const char *func, unsigned int line)\n {\n \t/* Log the timestamp, severity and file information. */\n \tclock_gettime(CLOCK_MONOTONIC, ×tamp_);\n \n \tstd::ostringstream ossFileInfo;\n-\tossFileInfo << utils::basename(fileName) << \":\" << line;\n+\tossFileInfo << utils::basename(fileName) << \" - \"\n+\t\t << func << \"():\" << line;\n \tfileInfo_ = ossFileInfo.str();\n }\n \n@@ -868,6 +871,7 @@ Loggable::~Loggable()\n /**\n * \\brief Create a temporary LogMessage object to log a message\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] severity The log message severity\n *\n@@ -876,10 +880,10 @@ Loggable::~Loggable()\n *\n * \\return A log message\n */\n-LogMessage Loggable::_log(const char *fileName, unsigned int line,\n-\t\t\t LogSeverity severity) const\n+LogMessage Loggable::_log(const char *fileName, const char *func,\n+\t\t\t unsigned int line, LogSeverity severity) const\n {\n-\tLogMessage msg(fileName, line, severity);\n+\tLogMessage msg(fileName, func, line, severity);\n \n \tmsg.stream() << logPrefix() << \": \";\n \treturn msg;\n@@ -888,6 +892,7 @@ LogMessage Loggable::_log(const char *fileName, unsigned int line,\n /**\n * \\brief Create a temporary LogMessage object to log a message\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] category The log message category\n * \\param[in] severity The log message severity\n@@ -897,11 +902,11 @@ LogMessage Loggable::_log(const char *fileName, unsigned int line,\n *\n * \\return A log message\n */\n-LogMessage Loggable::_log(const char *fileName, unsigned int line,\n-\t\t\t const LogCategory &category,\n+LogMessage Loggable::_log(const char *fileName, const char *func,\n+\t\t\t unsigned int line, const LogCategory &category,\n \t\t\t LogSeverity severity) const\n {\n-\tLogMessage msg(fileName, line, category, severity);\n+\tLogMessage msg(fileName, func, line, category, severity);\n \n \tmsg.stream() << logPrefix() << \": \";\n \treturn msg;\n@@ -910,6 +915,7 @@ LogMessage Loggable::_log(const char *fileName, unsigned int line,\n /**\n * \\brief Create a temporary LogMessage object to log a message\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] severity The log message severity\n *\n@@ -918,14 +924,16 @@ LogMessage Loggable::_log(const char *fileName, unsigned int line,\n *\n * \\return A log message\n */\n-LogMessage _log(const char *fileName, unsigned int line, LogSeverity severity)\n+LogMessage _log(const char *fileName, const char *func,\n+\t\tunsigned int line, LogSeverity severity)\n {\n-\treturn LogMessage(fileName, line, severity);\n+\treturn LogMessage(fileName, func, line, severity);\n }\n \n /**\n * \\brief Create a temporary LogMessage object to log a message\n * \\param[in] fileName The file name where the message is logged from\n+ * \\param[in] func The function name where the message is logged from\n * \\param[in] line The line number where the message is logged from\n * \\param[in] category The log message category\n * \\param[in] severity The log message severity\n@@ -935,10 +943,10 @@ LogMessage _log(const char *fileName, unsigned int line, LogSeverity severity)\n *\n * \\return A log message\n */\n-LogMessage _log(const char *fileName, unsigned int line,\n+LogMessage _log(const char *fileName, const char *func, unsigned int line,\n \t\tconst LogCategory &category, LogSeverity severity)\n {\n-\treturn LogMessage(fileName, line, category, severity);\n+\treturn LogMessage(fileName, func, line, category, severity);\n }\n \n /**\n", "prefixes": [ "libcamera-devel" ] }