]> git.proxmox.com Git - mirror_frr.git/blob - lib/zlog_targets.h
Merge pull request #6191 from NaveenThanikachalam/ibgp_connected
[mirror_frr.git] / lib / zlog_targets.h
1 /*
2 * Copyright (c) 2015-19 David Lamparter, for NetDEF, Inc.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef _FRR_ZLOG_TARGETS_H
18 #define _FRR_ZLOG_TARGETS_H
19
20 #include <pthread.h>
21
22 #include "zlog.h"
23
24 /* multiple file log targets can be active */
25
26 struct zlt_fd;
27
28 struct zlog_cfg_file {
29 struct zlt_fd *active;
30
31 pthread_mutex_t cfg_mtx;
32
33 /* call zlog_file_set_other() to apply these */
34 int prio_min;
35 char ts_subsec;
36 bool record_priority;
37
38 /* call zlog_file_set_filename/fd() to change this */
39 char *filename;
40 int fd;
41
42 void (*zlog_wrap)(struct zlog_target *zt, struct zlog_msg *msgs[],
43 size_t nmsgs);
44 };
45
46 extern void zlog_file_init(struct zlog_cfg_file *zcf);
47 extern void zlog_file_fini(struct zlog_cfg_file *zcf);
48
49 extern void zlog_file_set_other(struct zlog_cfg_file *zcf);
50 extern bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *name);
51 extern bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd);
52 extern bool zlog_file_rotate(struct zlog_cfg_file *zcf);
53
54 extern void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[],
55 size_t nmsgs);
56
57 /* syslog is always limited to one target */
58
59 extern void zlog_syslog_set_facility(int facility);
60 extern int zlog_syslog_get_facility(void);
61
62 /* use ZLOG_DISABLED to disable */
63 extern void zlog_syslog_set_prio_min(int prio_min);
64 extern int zlog_syslog_get_prio_min(void);
65
66 #endif /* _FRR_ZLOG_TARGETS_H */