summaryrefslogtreecommitdiffstats
path: root/src/dpdk/lib/librte_eal/common/eal_common_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dpdk/lib/librte_eal/common/eal_common_log.c')
-rw-r--r--src/dpdk/lib/librte_eal/common/eal_common_log.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/src/dpdk/lib/librte_eal/common/eal_common_log.c b/src/dpdk/lib/librte_eal/common/eal_common_log.c
index 7916c781..21975583 100644
--- a/src/dpdk/lib/librte_eal/common/eal_common_log.c
+++ b/src/dpdk/lib/librte_eal/common/eal_common_log.c
@@ -48,11 +48,12 @@ struct rte_logs rte_logs = {
.file = NULL,
};
+/* Stream to use for logging if rte_logs.file is NULL */
static FILE *default_log_stream;
/**
* This global structure stores some informations about the message
- * that is currently beeing processed by one lcore
+ * that is currently being processed by one lcore
*/
struct log_cur_msg {
uint32_t loglevel; /**< log level - see rte_log.h */
@@ -64,27 +65,11 @@ static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);
/* default logs */
-int
-rte_log_add_in_history(const char *buf __rte_unused, size_t size __rte_unused)
-{
- return 0;
-}
-
-void
-rte_log_set_history(int enable)
-{
- if (enable)
- RTE_LOG(WARNING, EAL, "The log history is deprecated.\n");
-}
-
/* Change the stream that will be used by logging system */
int
rte_openlog_stream(FILE *f)
{
- if (f == NULL)
- rte_logs.file = default_log_stream;
- else
- rte_logs.file = f;
+ rte_logs.file = f;
return 0;
}
@@ -131,12 +116,6 @@ int rte_log_cur_msg_logtype(void)
return RTE_PER_LCORE(log_cur_msg).logtype;
}
-/* Dump log history to file */
-void
-rte_log_dump_history(FILE *out __rte_unused)
-{
-}
-
/*
* Generates a log message The message will be sent in the stream
* defined by the previous call to rte_openlog_stream().
@@ -146,6 +125,19 @@ rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
{
int ret;
FILE *f = rte_logs.file;
+ if (f == NULL) {
+ f = default_log_stream;
+ if (f == NULL) {
+ /*
+ * Grab the current value of stderr here, rather than
+ * just initializing default_log_stream to stderr. This
+ * ensures that we will always use the current value
+ * of stderr, even if the application closes and
+ * reopens it.
+ */
+ f = stderr;
+ }
+ }
if ((level > rte_logs.level) || !(logtype & rte_logs.type))
return 0;
@@ -177,17 +169,15 @@ rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
}
/*
- * called by environment-specific log init function
+ * Called by environment-specific initialization functions.
*/
-int
-rte_eal_common_log_init(FILE *default_log)
+void
+eal_log_set_default(FILE *default_log)
{
default_log_stream = default_log;
- rte_openlog_stream(default_log);
-#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG
- RTE_LOG(NOTICE, EAL, "Debug logs available - lower performance\n");
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+ RTE_LOG(NOTICE, EAL,
+ "Debug dataplane logs available - lower performance\n");
#endif
-
- return 0;
}