1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
14 * default log function
17 console_log_write(__rte_unused void *c, const char *buf, size_t size)
22 ret = fwrite(buf, 1, size, stderr);
25 /* Syslog error levels are from 0 to 7, so subtract 1 to convert */
26 syslog(rte_log_cur_msg_loglevel() - 1, "%.*s", (int)size, buf);
32 console_log_close(__rte_unused void *c)
38 static cookie_io_functions_t console_log_func = {
39 .write = console_log_write,
40 .close = console_log_close,
44 * set the log to default function, called during eal init process,
45 * once memzones are available.
48 eal_log_init(const char *id, int facility)
52 log_stream = fopencookie(NULL, "w+", console_log_func);
53 if (log_stream == NULL)
56 openlog(id, LOG_NDELAY | LOG_PID, facility);
58 eal_log_set_default(log_stream);