Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/87796/?format=api
http://patchwork.dpdk.org/api/patches/87796/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210205112433.1681853-1-fengli@smartx.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20210205112433.1681853-1-fengli@smartx.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210205112433.1681853-1-fengli@smartx.com", "date": "2021-02-05T11:24:33", "name": "log: support custom log function", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f0dd1695e899f9fb5ff821c7224827235d5da373", "submitter": { "id": 1528, "url": "http://patchwork.dpdk.org/api/people/1528/?format=api", "name": "Li Feng", "email": "fengli@smartx.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210205112433.1681853-1-fengli@smartx.com/mbox/", "series": [ { "id": 15185, "url": "http://patchwork.dpdk.org/api/series/15185/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=15185", "date": "2021-02-05T11:24:33", "name": "log: support custom log function", "version": 1, "mbox": "http://patchwork.dpdk.org/series/15185/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/87796/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/87796/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 6331CA0524;\n\tFri, 5 Feb 2021 12:24:46 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 46084188742;\n\tFri, 5 Feb 2021 12:24:46 +0100 (CET)", "from mail-pg1-f176.google.com (mail-pg1-f176.google.com\n [209.85.215.176])\n by mails.dpdk.org (Postfix) with ESMTP id 249EF4067B\n for <dev@dpdk.org>; Fri, 5 Feb 2021 12:24:44 +0100 (CET)", "by mail-pg1-f176.google.com with SMTP id s23so4308584pgh.11\n for <dev@dpdk.org>; Fri, 05 Feb 2021 03:24:44 -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 x3sm9842292pfp.98.2021.02.05.03.24.41\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 05 Feb 2021 03:24:43 -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:mime-version\n :content-transfer-encoding;\n bh=mRzyNmZ3jWlvlR7nE1reXKQUB6IQfXzOxE/Cv5CHXvg=;\n b=YB+qwaTv3fVlNVIvZWdLcYrkuUd0McvmWCcjoLNjvVoLb+avtb5jIz73kEc/WM2vuh\n ZaYQvR6+lchGfkVtOPuJc4OUOVPEE43H5RnXrDSF/h3AzmWPItZEclSE58MoDrsztbVy\n Ld0Itfkjue2APhbTrIT6F3S+18OAyxcoCz9Gq7VPQE65RYKAwOn6uJSA9ZJ72jYOKHHL\n zv/d08sEz6jorUz6EHxfgg8csa8Lo8l5715CJy34jo+D84jDR7AatRcj8GzNVV/wvbv2\n RB7G2C3X2p07HnUHRiVCTez9/Ipj/o0li88vOgsD3ndBZ2GGNsDsj2vpJLFDb9dOPWKe\n u/Dg==", "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:mime-version\n :content-transfer-encoding;\n bh=mRzyNmZ3jWlvlR7nE1reXKQUB6IQfXzOxE/Cv5CHXvg=;\n b=SLxMiQYK8SlYX4y4EqMJXXdlNng0OgcyIgICBd7Ur/cZ4SCfuVv43snO9RdYZdwawy\n Krvgj4pTmINFduBjkXOwIZ4vIoOZTA3+g+PzV9Pqe0mdCkjTO6+nXC6KNhDKQLYoXqDQ\n 28utKHQF4CWlC/4tl8yxfZ7mTIaok09G/NN/xjPdp/dKLWHEhHbGWFMDBZhmXH3/mhYC\n cG8FjHesLDAYI4RHss7Td3KP4TAV75T4trRL/8rkaw+vhPBeyG5NIwHXTUWg0tN/+cbF\n pqxy16/MJ4yZqXSUhI+QBTthkBawt4gBpDzs6EX1clF4ckqjv1IbJNnYloy2K5cxQ3b1\n u4GA==", "X-Gm-Message-State": "AOAM531zLCiJz8cSBNB9aw80R7KH8TbSRJyZlETlLa9aMka0oUv2n9N6\n wk3Lt57cI/lJBiW8S7TzfTkLCw==", "X-Google-Smtp-Source": "\n ABdhPJz3xDGpJtjAgmBsq3xUeQwq/zQfX2hwRyJbc09mmVQTU97zgzeZypepgPtAhIDByKOtRo9WZQ==", "X-Received": "by 2002:a63:a10a:: with SMTP id b10mr3773375pgf.121.1612524283917;\n Fri, 05 Feb 2021 03:24:43 -0800 (PST)", "From": "Li Feng <fengli@smartx.com>", "To": "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>", "Cc": "dev@dpdk.org,\n\tlifeng1519@gmail.com,\n\tLi Feng <fengli@smartx.com>", "Date": "Fri, 5 Feb 2021 19:24:33 +0800", "Message-Id": "<20210205112433.1681853-1-fengli@smartx.com>", "X-Mailer": "git-send-email 2.29.2", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH] 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": "Currently, the dpdk log is out to stdout/stderr and syslog.\nWe should support to output the log to another please, e.g. file or\nglog.\n\nSigned-off-by: Li Feng <fengli@smartx.com>\n---\n lib/librte_eal/common/eal_private.h | 10 ----------\n lib/librte_eal/include/rte_eal.h | 22 ++++++++++++++++++++++\n lib/librte_eal/linux/eal.c | 2 +-\n lib/librte_eal/linux/eal_log.c | 13 ++++++++-----\n lib/librte_eal/windows/eal.c | 2 +-\n lib/librte_eal/windows/eal_log.c | 2 +-\n 6 files changed, 33 insertions(+), 18 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 4684c4c7d..8cfb399b8 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -143,16 +143,6 @@ int rte_eal_memory_init(void);\n */\n int rte_eal_timer_init(void);\n \n-/**\n- * Init the default log stream\n- *\n- * This function is private to EAL.\n- *\n- * @return\n- * 0 on success, negative on error\n- */\n-int rte_eal_log_init(const char *id, int facility);\n-\n /**\n * Save the log regexp for later\n */\ndiff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rte_eal.h\nindex eaf6469e5..f07d89f5f 100644\n--- a/lib/librte_eal/include/rte_eal.h\n+++ b/lib/librte_eal/include/rte_eal.h\n@@ -114,6 +114,28 @@ int rte_eal_iopl_init(void);\n */\n int rte_eal_init(int argc, char **argv);\n \n+/**\n+ * Usage function typedef used by the application usage function.\n+ *\n+ * Use this function typedef to define a logger formatter.\n+ */\n+typedef cookie_write_function_t rte_log_func_t;\n+\n+/**\n+ * Init the default log stream\n+ *\n+ * @param id\n+ * The openlog's first argument.\n+ * @param facility\n+ * The openlog's third argument.\n+ * @param logf\n+ * The customized logger function, if it's set, the id and facility will\n+ * be ignored.\n+ * @return\n+ * 0 on success, negative on error\n+ */\n+int rte_eal_log_init(const char *id, int facility, rte_log_func_t *logf);\n+\n /**\n * Clean up the Environment Abstraction Layer (EAL)\n *\ndiff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c\nindex 32b48c3de..62747b3a7 100644\n--- a/lib/librte_eal/linux/eal.c\n+++ b/lib/librte_eal/linux/eal.c\n@@ -1160,7 +1160,7 @@ rte_eal_init(int argc, char **argv)\n #endif\n \t}\n \n-\tif (rte_eal_log_init(logid, internal_conf->syslog_facility) < 0) {\n+\tif (rte_eal_log_init(logid, internal_conf->syslog_facility, NULL) < 0) {\n \t\trte_eal_init_alert(\"Cannot init logging.\");\n \t\trte_errno = ENOMEM;\n \t\t__atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);\ndiff --git a/lib/librte_eal/linux/eal_log.c b/lib/librte_eal/linux/eal_log.c\nindex 43c8460bf..f985b3d36 100644\n--- a/lib/librte_eal/linux/eal_log.c\n+++ b/lib/librte_eal/linux/eal_log.c\n@@ -37,18 +37,21 @@ console_log_write(__rte_unused void *c, const char *buf, size_t size)\n \treturn ret;\n }\n \n-static cookie_io_functions_t console_log_func = {\n-\t.write = console_log_write,\n-};\n-\n /*\n * set the log to default function, called during eal init process,\n * once memzones are available.\n */\n int\n-rte_eal_log_init(const char *id, int facility)\n+rte_eal_log_init(const char *id, int facility, rte_log_func_t *logf)\n {\n \tFILE *log_stream;\n+\tcookie_io_functions_t console_log_func;\n+\n+\tif (logf) {\n+\t\tconsole_log_func.write = logf;\n+\t} else {\n+\t\tconsole_log_func.write = console_log_write;\n+\t}\n \n \tlog_stream = fopencookie(NULL, \"w+\", console_log_func);\n \tif (log_stream == NULL)\ndiff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c\nindex 1e5f6576f..74fdd076a 100644\n--- a/lib/librte_eal/windows/eal.c\n+++ b/lib/librte_eal/windows/eal.c\n@@ -266,7 +266,7 @@ rte_eal_init(int argc, char **argv)\n \t\teal_get_internal_configuration();\n \tint ret;\n \n-\trte_eal_log_init(NULL, 0);\n+\trte_eal_log_init(NULL, 0, NULL);\n \n \teal_log_level_parse(argc, argv);\n \ndiff --git a/lib/librte_eal/windows/eal_log.c b/lib/librte_eal/windows/eal_log.c\nindex 875981f13..31f556908 100644\n--- a/lib/librte_eal/windows/eal_log.c\n+++ b/lib/librte_eal/windows/eal_log.c\n@@ -6,7 +6,7 @@\n \n /* set the log to default function, called during eal init process. */\n int\n-rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility)\n+rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility, rte_log_func_t *logf)\n {\n \trte_openlog_stream(stderr);\n \n", "prefixes": [] }{ "id": 87796, "url": "