Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/87968/?format=api
https://patches.dpdk.org/api/patches/87968/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210218061253.2812991-1-fengli@smartx.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20210218061253.2812991-1-fengli@smartx.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210218061253.2812991-1-fengli@smartx.com", "date": "2021-02-18T06:12:53", "name": "[v4] log: support custom log function", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "6d63f02dcf7f00ddbff036d686c687903af56225", "submitter": { "id": 1528, "url": "https://patches.dpdk.org/api/people/1528/?format=api", "name": "Li Feng", "email": "fengli@smartx.com" }, "delegate": { "id": 24651, "url": "https://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210218061253.2812991-1-fengli@smartx.com/mbox/", "series": [ { "id": 15280, "url": "https://patches.dpdk.org/api/series/15280/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=15280", "date": "2021-02-18T06:12:53", "name": "[v4] log: support custom log function", "version": 4, "mbox": "https://patches.dpdk.org/series/15280/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/87968/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/87968/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id CEE2BA054D;\n\tThu, 18 Feb 2021 07:13:10 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4F41D40698;\n\tThu, 18 Feb 2021 07:13:10 +0100 (CET)", "from mail-pl1-f176.google.com (mail-pl1-f176.google.com\n [209.85.214.176])\n by mails.dpdk.org (Postfix) with ESMTP id 6CE5A40697\n for <dev@dpdk.org>; Thu, 18 Feb 2021 07:13:09 +0100 (CET)", "by mail-pl1-f176.google.com with SMTP id d15so670021plh.4\n for <dev@dpdk.org>; Wed, 17 Feb 2021 22:13:09 -0800 (PST)", "from localhost.localdomain\n (ec2-18-163-5-123.ap-east-1.compute.amazonaws.com. [18.163.5.123])\n by smtp.gmail.com with ESMTPSA id c22sm4364743pfo.136.2021.02.17.22.13.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 17 Feb 2021 22:13:07 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=smartx-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=Mt5/hnm/upjfX8MbeIvqnpUSzqfx5LUl3O2Y5YxaK8M=;\n b=U1Bun+FJbJAvKn5ZL+mcSzI4zBJhbGtRVB0OzD9F/KcdqoM8rv5bbD3koYAVB85PnH\n ZLuj+7GQ8OQwc5kxtvCqdEYCFLGidcEkaTqc3Rmn0al9+4rB1MBkAAxq1Wtzm/VOPoRe\n +c65KMXR6tdGa358isD61zPWe1uQ1dl5oDt1mQ/eCmMwv3vTwshJ/baOQZzj+IYVOlKL\n jpkVcnqgff8gnAuxlDI1kSC7U0oaCJJRBW5Pmnrv3/NHnbSvCi/BLwOwddYC9Da1ERU4\n lX1KWhHRYJvmdQhZ+/9j9N1UWJIV6GjimIgfmjUfTFfYlOka2xeoPX1CXx1gT6kjnIpJ\n kiqw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=Mt5/hnm/upjfX8MbeIvqnpUSzqfx5LUl3O2Y5YxaK8M=;\n b=L7bqS3lBP+REoillVDvUKS3im+zDPX9Y08TZo9/caFehiNuAGd43YG2HyE4fwSv5B4\n F8q7t9rf8YjxQY2ZFzBQCIhFwCDxOihLx7v21qKEH3p8R6h5Y8DNk3N1rsBMXw3BTBzU\n pHHV7Qsj0xITeJ75zODBdfd7hT0xUWR/NUFwknmILsTksbnuH/y3Dv4P0laCQXbPBIRO\n WggsUYQLVQNP5RFE2LKp8/vUk6g5T2L2a42IY9W/xQaAk8ngWU9ic8LvuVTvLFpX42l3\n 06U5tCmdfMvCB8y0ffSNIWN/kf55i2WdkWq4w1kQH2KKTlHo7ORB7RqeZPw9mMZPS2hH\n c71g==", "X-Gm-Message-State": "AOAM532dncsXCit+UNt85CkwUz+txN8W/9tQexGYRcdsGvkJhUjBt6aS\n BkbbBUznqrPrDZChBY+EKL6JpQ==", "X-Google-Smtp-Source": "\n ABdhPJwCy+ZjR9RIXyhz/fCxtZeOZOINEwA1CUc2uHOVAmnrm4VUYCiqzckCFxF7JtyqU+bS31cM+A==", "X-Received": "by 2002:a17:902:8342:b029:e1:1465:4bf0 with SMTP id\n z2-20020a1709028342b02900e114654bf0mr2654575pln.76.1613628788500;\n Wed, 17 Feb 2021 22:13:08 -0800 (PST)", "From": "Li Feng <fengli@smartx.com>", "To": "David Marchand <david.marchand@redhat.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>", "Cc": "dev@dpdk.org,\n\tlifeng1519@gmail.com,\n\tLi Feng <fengli@smartx.com>", "Date": "Thu, 18 Feb 2021 14:12:53 +0800", "Message-Id": "<20210218061253.2812991-1-fengli@smartx.com>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20210205112433.1681853-1-fengli@smartx.com>", "References": "<20210205112433.1681853-1-fengli@smartx.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v4] log: support custom log function", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "By default, the dpdk log is out to stdout/stderr and syslog.\nThe rte_openlog_stream could set an external FILE* stream, but it\nasks the consumer to give it a FILE* pointer.\nFor C++ or other languages, it's hard to get a libc FILE*.\n\nSupport to set a hook is another choice for this scenario.\n\nSigned-off-by: Li Feng <fengli@smartx.com>\n---\nv4: Fix the code style.\nv3: Rename the func, change the comments, add funcs in version.map.\nv2: Simplify the code.\n\n lib/librte_eal/include/rte_log.h | 31 +++++++++++++++++++++++++++++++\n lib/librte_eal/linux/eal_log.c | 23 +++++++++++++++++++++++\n lib/librte_eal/version.map | 2 ++\n lib/librte_eal/windows/eal_log.c | 19 +++++++++++++++++++\n 4 files changed, 75 insertions(+)", "diff": "diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h\nindex 173004fd7..adf299610 100644\n--- a/lib/librte_eal/include/rte_log.h\n+++ b/lib/librte_eal/include/rte_log.h\n@@ -97,6 +97,37 @@ int rte_openlog_stream(FILE *f);\n */\n FILE *rte_log_get_stream(void);\n \n+/**\n+ * Define a logging write function.\n+ */\n+typedef ssize_t rte_log_write_function(void *cookie, const char *buf,\n+\tsize_t size);\n+\n+/**\n+ * Change the default stream's write action that will be used by the logging\n+ * system.\n+ *\n+ * This should be done before the 'rte_eal_init' call. And the\n+ * 'rte_openlog_stream' call will override this action.\n+ *\n+ * @param logf\n+ * Pointer to the log write function.\n+ */\n+__rte_experimental\n+void\n+rte_log_sink_set(rte_log_write_function *logf);\n+\n+/**\n+ * Retrieve the log function used by the logging system (see rte_log_sink_set()\n+ * to change it).\n+ *\n+ * @return\n+ * Pointer to the log function.\n+ */\n+__rte_experimental\n+rte_log_write_function*\n+rte_log_sink_get(void);\n+\n /**\n * Set the global log level.\n *\ndiff --git a/lib/librte_eal/linux/eal_log.c b/lib/librte_eal/linux/eal_log.c\nindex 43c8460bf..fb3ac3f14 100644\n--- a/lib/librte_eal/linux/eal_log.c\n+++ b/lib/librte_eal/linux/eal_log.c\n@@ -60,3 +60,26 @@ rte_eal_log_init(const char *id, int facility)\n \n \treturn 0;\n }\n+\n+/**\n+ * Change the default stream's write action that will be used by the logging\n+ * system.\n+ *\n+ * This should be done before the 'rte_eal_init' call. And the\n+ * 'rte_openlog_stream' call will override this action.\n+ */\n+void\n+rte_log_sink_set(rte_log_write_function *logf)\n+{\n+\tconsole_log_func.write = logf;\n+}\n+\n+/**\n+ * Retrieve the log function used by the logging system (see rte_log_sink_set()\n+ * to change it).\n+ */\n+rte_log_write_function*\n+rte_log_sink_get(void)\n+{\n+\treturn console_log_func.write;\n+}\ndiff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map\nindex fce90a112..04d651912 100644\n--- a/lib/librte_eal/version.map\n+++ b/lib/librte_eal/version.map\n@@ -412,6 +412,8 @@ EXPERIMENTAL {\n \trte_thread_tls_key_delete;\n \trte_thread_tls_value_get;\n \trte_thread_tls_value_set;\n+\trte_log_sink_set;\n+\trte_log_sink_get;\n };\n \n INTERNAL {\ndiff --git a/lib/librte_eal/windows/eal_log.c b/lib/librte_eal/windows/eal_log.c\nindex 875981f13..589b47f27 100644\n--- a/lib/librte_eal/windows/eal_log.c\n+++ b/lib/librte_eal/windows/eal_log.c\n@@ -14,3 +14,22 @@ rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility)\n \n \treturn 0;\n }\n+\n+/*\n+ * Set the customized logger, it will override the default stream write action,\n+ * which is writing to syslog and stdout.\n+ */\n+void\n+rte_log_sink_set(rte_log_write_function *logf)\n+{\n+\tRTE_SET_USED(logf);\n+}\n+\n+/*\n+ * Retrieve the default log write function.\n+ */\n+rte_log_write_function*\n+rte_log_sink_get(void)\n+{\n+\treturn NULL;\n+}\n", "prefixes": [ "v4" ] }{ "id": 87968, "url": "