[1/2] eal: initialize eal logging on Windows

Message ID 20200429232427.7112-2-pallavi.kadam@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Windows logging |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS

Commit Message

Kadam, Pallavi April 29, 2020, 11:24 p.m. UTC
  Add logging function on Windows to send log output to the console.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Tasnim Bashar <tbashar@mellanox.com>
Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_eal/windows/eal.c       |  3 +++
 lib/librte_eal/windows/eal_log.c   | 16 ++++++++++++++++
 lib/librte_eal/windows/meson.build |  1 +
 3 files changed, 20 insertions(+)
 create mode 100644 lib/librte_eal/windows/eal_log.c
  

Patch

diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 2cf7a04ef..123afed8d 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -227,6 +227,9 @@  rte_eal_init(int argc, char **argv)
 {
 	int i, fctret;
 
+	/* initialize all logs */
+	rte_eal_log_init(NULL, 0);
+
 	eal_log_level_parse(argc, argv);
 
 	/* create a map of all processors in the system */
diff --git a/lib/librte_eal/windows/eal_log.c b/lib/librte_eal/windows/eal_log.c
new file mode 100644
index 000000000..875981f13
--- /dev/null
+++ b/lib/librte_eal/windows/eal_log.c
@@ -0,0 +1,16 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017-2018 Intel Corporation
+ */
+
+#include "eal_private.h"
+
+/* set the log to default function, called during eal init process. */
+int
+rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility)
+{
+	rte_openlog_stream(stderr);
+
+	eal_log_set_default(stderr);
+
+	return 0;
+}
diff --git a/lib/librte_eal/windows/meson.build b/lib/librte_eal/windows/meson.build
index 09dd4ab2f..e5d1d8336 100644
--- a/lib/librte_eal/windows/meson.build
+++ b/lib/librte_eal/windows/meson.build
@@ -7,6 +7,7 @@  sources += files(
 	'eal.c',
 	'eal_debug.c',
 	'eal_lcore.c',
+	'eal_log.c',
 	'eal_thread.c',
 	'getopt.c',
 )