]> git.proxmox.com Git - mirror_frr.git/blob - lib/zlog_targets.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / zlog_targets.h
1 // SPDX-License-Identifier: ISC
2 /*
3 * Copyright (c) 2015-19 David Lamparter, for NetDEF, Inc.
4 */
5
6 #ifndef _FRR_ZLOG_TARGETS_H
7 #define _FRR_ZLOG_TARGETS_H
8
9 #include <pthread.h>
10
11 #include "zlog.h"
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /* multiple file log targets can be active */
18
19 struct zlt_fd;
20
21 struct zlog_cfg_file {
22 struct zlt_fd *active;
23
24 pthread_mutex_t cfg_mtx;
25
26 /* call zlog_file_set_other() to apply these */
27 int prio_min;
28 char ts_subsec;
29 bool record_priority;
30
31 /* call zlog_file_set_filename/fd() to change this */
32 char *filename;
33 int fd;
34
35 void (*zlog_wrap)(struct zlog_target *zt, struct zlog_msg *msgs[],
36 size_t nmsgs);
37 };
38
39 extern void zlog_file_init(struct zlog_cfg_file *zcf);
40 extern void zlog_file_fini(struct zlog_cfg_file *zcf);
41
42 extern void zlog_file_set_other(struct zlog_cfg_file *zcf);
43 extern bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *name);
44 extern bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd);
45 extern bool zlog_file_rotate(struct zlog_cfg_file *zcf);
46
47 extern void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[],
48 size_t nmsgs);
49
50 /* syslog is always limited to one target */
51
52 extern void zlog_syslog_set_facility(int facility);
53 extern int zlog_syslog_get_facility(void);
54
55 /* use ZLOG_DISABLED to disable */
56 extern void zlog_syslog_set_prio_min(int prio_min);
57 extern int zlog_syslog_get_prio_min(void);
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif /* _FRR_ZLOG_TARGETS_H */