1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
10 #include <sys/queue.h>
12 #include <rte_memory.h>
14 #include <rte_launch.h>
15 #include <rte_per_lcore.h>
16 #include <rte_lcore.h>
17 #include <rte_spinlock.h>
20 #include "eal_private.h"
23 * default log function
26 console_log_write(__attribute__((unused
)) void *c
, const char *buf
, size_t size
)
31 ret
= fwrite(buf
, 1, size
, stdout
);
34 /* Syslog error levels are from 0 to 7, so subtract 1 to convert */
35 syslog(rte_log_cur_msg_loglevel() - 1, "%.*s", (int)size
, buf
);
40 static cookie_io_functions_t console_log_func
= {
41 .write
= console_log_write
,
45 * set the log to default function, called during eal init process,
46 * once memzones are available.
49 rte_eal_log_init(const char *id
, int facility
)
53 log_stream
= fopencookie(NULL
, "w+", console_log_func
);
54 if (log_stream
== NULL
)
57 openlog(id
, LOG_NDELAY
| LOG_PID
, facility
);
59 eal_log_set_default(log_stream
);