Thread (21 messages) 21 messages, 5 authors, 2023-06-15

Re: [dpdk-dev] [PATCH] log: support custom log function

From: Feng Li <hidden>
Date: 2021-02-07 09:38:45

Feng Li [off-list ref] 于2021年2月6日周六 上午12:54写道:
Stephen Hemminger [off-list ref] 于2021年2月6日周六 上午12:11写道:
quoted
On Fri, 5 Feb 2021 12:55:48 +0100
David Marchand [off-list ref] wrote:
quoted
On Fri, Feb 5, 2021 at 12:25 PM Li Feng [off-list ref] wrote:
quoted
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 = google::GLOG_INFO;
| +    (void)c;
| +    google::LogMessage(__FILE__, __LINE__, glog_level).stream()
| +        << "[DPDK/" << __FUNCTION__ << "] " << std::string(buf, size);
| +    return 0;
| +}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help