Blob


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