Merge branch 'jk/promote-ggg'
[git] / trace2 / tr2_dst.h
1 #ifndef TR2_DST_H
2 #define TR2_DST_H
3
4 struct strbuf;
5
6 struct tr2_dst {
7         const char *const env_var_name;
8         int fd;
9         unsigned int initialized : 1;
10         unsigned int need_close : 1;
11 };
12
13 /*
14  * Disable TRACE2 on the destination.  In TRACE2 a destination (DST)
15  * wraps a file descriptor; it is associated with a TARGET which
16  * defines the formatting.
17  */
18 void tr2_dst_trace_disable(struct tr2_dst *dst);
19
20 /*
21  * Return the file descriptor for the DST.
22  * If 0, the dst is closed or disabled.
23  */
24 int tr2_dst_get_trace_fd(struct tr2_dst *dst);
25
26 /*
27  * Return true if the DST is opened for writing.
28  */
29 int tr2_dst_trace_want(struct tr2_dst *dst);
30
31 /*
32  * Write a single line/message to the trace file.
33  */
34 void tr2_dst_write_line(struct tr2_dst *dst, struct strbuf *buf_line);
35
36 #endif /* TR2_DST_H */