mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-01-01 12:11:17 +00:00
56 lines
1.4 KiB
C
56 lines
1.4 KiB
C
/*
|
|
* Copyright (C) 2011 Red Hat, Inc.
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* Author: Angus Salkeld <asalkeld@redhat.com>
|
|
*
|
|
* libqb is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 2.1 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* libqb is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "os_base.h"
|
|
#include <syslog.h>
|
|
#include <qb/qbrb.h>
|
|
#include "log_int.h"
|
|
|
|
static void _syslog_logger(struct qb_log_target *t,
|
|
struct qb_log_callsite *cs,
|
|
const char* timestamp_str,
|
|
const char *msg)
|
|
{
|
|
syslog(cs->priority, "%s", msg);
|
|
}
|
|
|
|
static void _syslog_close(struct qb_log_target *t)
|
|
{
|
|
closelog();
|
|
}
|
|
|
|
static void _syslog_reload(struct qb_log_target *t)
|
|
{
|
|
closelog();
|
|
openlog(t->name, LOG_PID, t->facility);
|
|
}
|
|
|
|
int32_t qb_log_syslog_open(struct qb_log_target *t)
|
|
{
|
|
t->logger = _syslog_logger;
|
|
t->reload = _syslog_reload;
|
|
t->close = _syslog_close;
|
|
|
|
openlog(t->name, LOG_PID, t->facility);
|
|
return 0;
|
|
}
|
|
|
|
|