From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 657E9A0547; Sun, 7 Feb 2021 10:38:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D0091606D0; Sun, 7 Feb 2021 10:38:39 +0100 (CET) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by mails.dpdk.org (Postfix) with ESMTP id B37274067B for ; Fri, 5 Feb 2021 18:06:36 +0100 (CET) Received: by mail-lf1-f46.google.com with SMTP id f1so10900514lfu.3 for ; Fri, 05 Feb 2021 09:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=H12Rj6yN6g45lJx7BYOThnK6GD3U7bZtFN2B0RLbb+g=; b=WDeR6RWUbzFZNY31OlxDiBQiTqftfzQtvqHIxuVfW/h9dFFG3lG8BV2zy8DIsJ3Dvp 04RsTfH/8pnV3D0e0a+7AvU+to3Pw8OcnKENX499dECYP0JGULe/iBynjQDB7NozxECL 99UuHuOssu4NZZQB4I14FAnZ48PFnLU0SO0uXptnV7QKwQlHpUA530fsxqNp5P+wetjQ PvA8orFjoj3w7Lqp5/DkKbjZxOPOONrc10dREUJD59KUUDOmUy8U1TcDcxkjyhPQA1PE EYGdlpyxrafXdArTQikTf4vYyM7yv7WDtjbjiiRQF5ut6K1JvLmO56FDfX8QHoefvskD AIOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=H12Rj6yN6g45lJx7BYOThnK6GD3U7bZtFN2B0RLbb+g=; b=muAc8ctJRRLgcS4CJjKk4RP3hiQd/bvMpwzNFhCIk+vLBdos2yQCtMIlcrTYdPNyo2 FprVan6qZbDx6Sn0Hj+V7hnK40QQMqo9mCYCK98ZT0PNz2GkqJd75XJXnd7mB+hPVPpP g/TMTG1xJ3aCRk0ztvm9PGgtUxvNr0UQTb9Q9935bhaz+3FKUq5X8AhXi5QUKd7XNzMk 99Q8zXggJnLlPO+bIco0ATMwiaS5mb3kp7PrZBvVrRihsnJNaswDzSM22nWcahSY8lh9 7hLL0mJjO0W4O+bMbUlJMyIuoDPYR6r+dU3ipRTq/HEfmApPTfpraX+Wr5ldhDpeLYfX ds+w== X-Gm-Message-State: AOAM533gdRGfzc3NNQFg9z8r9QQKfAZYW48smlzX0BfEL2mQRlHhVH9z FDVTWKgysvK2+d0mQ+etTEinMAHykfCooZixdQw= X-Google-Smtp-Source: ABdhPJzLwxi/rBXsIFkNXYotxRemjpEvo1aEEDdHVu3qQraStoptSH9gexQmDPzgl3qHbjjp1/WPe74Kfiqb0QTotUs= X-Received: by 2002:a19:fc06:: with SMTP id a6mr3098564lfi.529.1612544796204; Fri, 05 Feb 2021 09:06:36 -0800 (PST) MIME-Version: 1.0 References: <20210205112433.1681853-1-fengli@smartx.com> <20210205081056.32c69647@hermes.local> In-Reply-To: From: Feng Li Date: Sat, 6 Feb 2021 01:06:10 +0800 Message-ID: To: stephen@networkplumber.org Cc: David Marchand , Li Feng , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam , dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Sun, 07 Feb 2021 10:38:37 +0100 Subject: Re: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Feng Li =E4=BA=8E2021=E5=B9=B42=E6=9C=886=E6=97=A5= =E5=91=A8=E5=85=AD =E4=B8=8A=E5=8D=8812:54=E5=86=99=E9=81=93=EF=BC=9A > > Stephen Hemminger =E4=BA=8E2021=E5=B9=B42=E6= =9C=886=E6=97=A5=E5=91=A8=E5=85=AD =E4=B8=8A=E5=8D=8812:11=E5=86=99=E9=81= =93=EF=BC=9A > > > > On Fri, 5 Feb 2021 12:55:48 +0100 > > David Marchand wrote: > > > > > On Fri, Feb 5, 2021 at 12:25 PM Li Feng wrote: > > > > > > > > Currently, the dpdk log is out to stdout/stderr and syslog. > > > > We should support to output the log to another please, e.g. file or > > > > glog. > > > > > > Why not use rte_openlog_stream() / rte_log_get_stream() ? > > > > Agree, I have used rte_openlog_stream several times to do this. > As Dmitry Kozlyuk said, FILE* is convenient for the C/libc, but not > for other languages. > C++ standard IO stream is the case. The usage is like this: | +static ssize_t eal_log_func(void* c, const char* buf, size_t size) { | + int glog_level =3D google::GLOG_INFO; | + (void)c; | + google::LogMessage(__FILE__, __LINE__, glog_level).stream() | + << "[DPDK/" << __FUNCTION__ << "] " << std::string(buf, size); | + return 0; | +}