]>
Commit | Line | Data |
---|---|---|
0bdeb5e5 DL |
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 | ||
17e38209 RW |
24 | #ifdef __cplusplus |
25 | extern "C" { | |
26 | #endif | |
27 | ||
0bdeb5e5 DL |
28 | /* multiple file log targets can be active */ |
29 | ||
30 | struct zlt_fd; | |
31 | ||
32 | struct zlog_cfg_file { | |
33 | struct zlt_fd *active; | |
34 | ||
35 | pthread_mutex_t cfg_mtx; | |
36 | ||
37 | /* call zlog_file_set_other() to apply these */ | |
38 | int prio_min; | |
39 | char ts_subsec; | |
40 | bool record_priority; | |
41 | ||
42 | /* call zlog_file_set_filename/fd() to change this */ | |
43 | char *filename; | |
44 | int fd; | |
1c408628 DL |
45 | |
46 | void (*zlog_wrap)(struct zlog_target *zt, struct zlog_msg *msgs[], | |
47 | size_t nmsgs); | |
0bdeb5e5 DL |
48 | }; |
49 | ||
50 | extern void zlog_file_init(struct zlog_cfg_file *zcf); | |
51 | extern void zlog_file_fini(struct zlog_cfg_file *zcf); | |
52 | ||
53 | extern void zlog_file_set_other(struct zlog_cfg_file *zcf); | |
54 | extern bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *name); | |
55 | extern bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd); | |
56 | extern bool zlog_file_rotate(struct zlog_cfg_file *zcf); | |
57 | ||
1c408628 DL |
58 | extern void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[], |
59 | size_t nmsgs); | |
60 | ||
0bdeb5e5 DL |
61 | /* syslog is always limited to one target */ |
62 | ||
63 | extern void zlog_syslog_set_facility(int facility); | |
64 | extern int zlog_syslog_get_facility(void); | |
65 | ||
66 | /* use ZLOG_DISABLED to disable */ | |
67 | extern void zlog_syslog_set_prio_min(int prio_min); | |
68 | extern int zlog_syslog_get_prio_min(void); | |
69 | ||
17e38209 RW |
70 | #ifdef __cplusplus |
71 | } | |
72 | #endif | |
73 | ||
0bdeb5e5 | 74 | #endif /* _FRR_ZLOG_TARGETS_H */ |