aboutsummaryrefslogtreecommitdiff
path: root/man/man3/venti-log.3
blob: b0a99062bcb960f47d53fc02cd728951172d3409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.TH VENTI-LOG 3
.SH NAME
VtLog,
VtLogChunk, 
vtlog,
vtlogclose,
vtlogdump,
vtlognames,
vtlogopen,
vtlogprint,
vtlogremove,
vtlogopen,
ventilogging \- Venti logs
.SH SYNOPSIS
.ft L
#include <u.h>
.br
#include <libc.h>
.br
#include <venti.h>
.ta +\w'\fLVtLog* 'u
.PP
.B
VtLog*	vtlogopen(char *name, uint size);
.PP
.B
void	vtlogprint(VtLog *log, char *fmt, ...);
.PP
.B
void	vtlogclose(VtLog *log);
.PP
.B
void	vtlog(char *name, char *fmt, ...);
.PP
.B
void	vtlogremove(char *name);
.PP
.B
char**	vtlognames(int *n);
.PP
.B
void	vtlogdump(int fd, VtLog *log);
.PP
.B
extern int ventilogging;    /* default 0 */
.PP
.B
extern char *VtServerLog;    /* "libventi/server" */
.SH DESCRIPTION
These routines provide an in-memory circular log
structure used by the Venti library and the Venti server
to record events for debugging purposes.
The logs are named by UTF strings.
.PP
.I Vtlogopen
returns a reference to the log with the given
.I name .
If a log with that name does not exist and
.I size 
is non-zero,
.I vtlogopen
creates a new log capable of holding at
least
.I size
bytes and returns it.
.I Vtlogclose
releases the reference returned by
.IR vtlogopen .
.PP
.I Vtlogprint
writes to
.IR log ,
which must be open.
.PP
.I Vtlog
is a convenient packaging of
.I vtlogopen
followed by
.I vtlogprint
and
.IR vtlogclose .
.PP
.I Vtlogremove
removes the log with the given
.IR name ,
freeing any associated storage.
.PP
.I Vtlognames
returns a list of the names of all the logs.
The length of the list is returned in
.BI * n \fR.
The list
should be freed
by calling
.I vtfree
on the returned pointer.
The strings in the list will be freed by this call as well.
(It is an error to call
.I vtfree
on any of the strings in the list.)
.PP
.I Vtlogdump
prints
.IR log ,
which must be open, to the file descriptor
.IR fd .
.PP
If
.I ventilogging
is set to zero (the default),
.I vtlognames
and
.I vtlogdump
can inspect existing logs, but
.I vtlogopen
always returns nil
and
.I vtlog
is a no-op.
The other functions are no-ops when
passed nil log structures.
.PP
The server library
(see
.MR venti-conn (3)
and
.MR venti-server (3) )
writes debugging information to the log named
.IR VtServerLog ,
which defaults to the string
.RB ` libventi/server '.
.SH SOURCE
.B \*9/src/libventi
.SH SEE ALSO
.MR venti (3) ,
.MR venti (8)