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

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

From: Dmitry Kozlyuk <hidden>
Date: 2021-02-08 22:40:38

On Mon, 8 Feb 2021 14:58:29 +0800, Feng Li wrote:
quoted
quoted
+/**
+ * Usage function typedef used by the application usage function.  
It's unrelated to the following typedef purpose, is it?  
It's borrowed from the front typedef sentence.
Doesn't make much sense here anyway.
quoted
quoted
+ *
+ * Use this function typedef to define a logger formatter.
+ */
+typedef cookie_write_function_t rte_log_func_t;  
"cookie_write_function_t" is not standard C, please write this type
explicitly. POSIX reserves "_t" suffix, "rte_" prefix is enough.  
Fix to this?
typedef cookie_write_function_t rte_cookie_write_function;
You cannot expose "cookie_write_function_t" in public API, because it is not
portable. You have to write out the type in full.
I'd replace "cookie" with "log".
void rte_log_sink_set(rte_cookie_write_function* cookie_write);
rte_cookie_write_function* rte_log_sink_get();
Right?
OK.
quoted
quoted
+void
+rte_eal_set_log_func(rte_log_func_t *logf)
+{
+    console_log_func.write = logf;
+}
Is this correct? AFAIK, updating the member has no effect, unless you call
fopencookie() with an updated structure.

Your new callbacks don't seem to be integrated with DPDK logging system for
all platforms ("eal_common_log.c", "windows/eal_log.c"). If the new API and
rte_openlog_stream() cancel effect of each other, this should be documented.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help