]> git.proxmox.com Git - mirror_frr.git/blame - lib/zlog_targets.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / zlog_targets.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: ISC
0bdeb5e5
DL
2/*
3 * Copyright (c) 2015-19 David Lamparter, for NetDEF, Inc.
0bdeb5e5
DL
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
17e38209
RW
13#ifdef __cplusplus
14extern "C" {
15#endif
16
0bdeb5e5
DL
17/* multiple file log targets can be active */
18
19struct zlt_fd;
20
21struct 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;
1c408628
DL
34
35 void (*zlog_wrap)(struct zlog_target *zt, struct zlog_msg *msgs[],
36 size_t nmsgs);
0bdeb5e5
DL
37};
38
39extern void zlog_file_init(struct zlog_cfg_file *zcf);
40extern void zlog_file_fini(struct zlog_cfg_file *zcf);
41
42extern void zlog_file_set_other(struct zlog_cfg_file *zcf);
43extern bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *name);
44extern bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd);
45extern bool zlog_file_rotate(struct zlog_cfg_file *zcf);
46
1c408628
DL
47extern void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[],
48 size_t nmsgs);
49
0bdeb5e5
DL
50/* syslog is always limited to one target */
51
52extern void zlog_syslog_set_facility(int facility);
53extern int zlog_syslog_get_facility(void);
54
55/* use ZLOG_DISABLED to disable */
56extern void zlog_syslog_set_prio_min(int prio_min);
57extern int zlog_syslog_get_prio_min(void);
58
17e38209
RW
59#ifdef __cplusplus
60}
61#endif
62
0bdeb5e5 63#endif /* _FRR_ZLOG_TARGETS_H */