| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #include "nd_log-internals.h" |
| 4 | |
| 5 | void nd_log_init_syslog(void) { |
| 6 | if(nd_log.syslog.initialized) |
| 7 | return; |
| 8 | |
| 9 | openlog(program_name, LOG_PID, nd_log.syslog.facility); |
| 10 | nd_log.syslog.initialized = true; |
| 11 | } |
| 12 | |
| 13 | bool nd_logger_syslog(int priority, ND_LOG_FORMAT format __maybe_unused, struct log_field *fields, size_t fields_max) { |
| 14 | CLEAN_BUFFER *wb = buffer_create(1024, NULL); |
| 15 | |
| 16 | nd_logger_logfmt(wb, fields, fields_max); |
| 17 | syslog(priority, "%s", buffer_tostring(wb)); |
| 18 | |
| 19 | return true; |
| 20 | } |