summaryrefslogtreecommitdiff
path: root/lib/syslog-null.c
blob: 9dbd13911c21f4eed0c9ab1d0c77a492ade493aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Copyright (c) 2015, 2016 Nicira, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "syslog-null.h"

#include <config.h>

#include "compiler.h"
#include "syslog-provider.h"
#include "util.h"

static void syslog_null_open(struct syslogger *this, int facility);
static void syslog_null_log(struct syslogger *this, int pri, const char *msg);

static struct syslog_class syslog_null_class = {
    syslog_null_open,
    syslog_null_log,
};

struct syslog_null {
    struct syslogger parent;
};

/* This function  creates object that delegate all logging to null's
 * syslog implementation. */
struct syslogger *
syslog_null_create(void)
{
    struct syslog_null *this = xmalloc(sizeof *this);

    this->parent.class = &syslog_null_class;
    this->parent.prefix = "";

    return &this->parent;
}

static void
syslog_null_open(struct syslogger *this OVS_UNUSED, int facility OVS_UNUSED)
{
    /* Nothing to do. */
}

static void
syslog_null_log(struct syslogger *this OVS_UNUSED, int pri OVS_UNUSED,
                const char *msg OVS_UNUSED)
{
    /* Nothing to do. */
}