NAME
VtLog, VtLogChunk, vtlog, vtlogclose, vtlogdump, vtlognames, vtlogopen, vtlogprint, vtlogremove, vtlogopen, ventilogging – Venti logs

SYNOPSIS
#include <u.h>
#include <libc.h>
#include <venti.h>

VtLog* vtlogopen(char *name, uint size);

void     vtlogprint(VtLog *log, char *fmt, ...);

void     vtlogclose(VtLog *log);

void     vtlog(char *name, char *fmt, ...);

void     vtlogremove(char *name);

char** vtlognames(int *n);

void     vtlogdump(int fd, VtLog *log);

extern int ventilogging;      /* default 0 */

extern char *VtServerLog;      /* "libventi/server" */

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.

Vtlogopen returns a reference to the log with the given name . If a log with that name does not exist and size is non–zero, vtlogopen creates a new log capable of holding at least size bytes and returns it. Vtlogclose releases the reference returned by vtlogopen.

Vtlogprint writes to log, which must be open.

Vtlog is a convenient packaging of vtlogopen followed by vtlogprint and vtlogclose.

Vtlogremove removes the log with the given name, freeing any associated storage.

Vtlognames returns a list of the names of all the logs. The length of the list is returned in *n. The list should be freed by calling vtfree on the returned pointer. The strings in the list will be freed by this call as well. (It is an error to call vtfree on any of the strings in the list.)

Vtlogdump prints log, which must be open, to the file descriptor fd.

If ventilogging is set to zero (the default), vtlognames and vtlogdump can inspect existing logs, but vtlogopen always returns nil and vtlog is a no–op. The other functions are no–ops when passed nil log structures.

The server library (see venti–conn(2) and venti–server(2)) writes debugging information to the log named VtServerLog, which defaults to the string `libventi/server'.

SOURCE
/sys/src/libventi

SEE ALSO
venti(2), venti(8)
Copyright © 2024 Alcatel-Lucent. All rights reserved.