1
0

venti-log 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. .TH VENTI-LOG 2
  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 are named by UTF strings.
  54. .PP
  55. .I Vtlogopen
  56. returns a reference to the log with the given
  57. .I name .
  58. If a log with that name does not exist and
  59. .I size
  60. is non-zero,
  61. .I vtlogopen
  62. creates a new log capable of holding at
  63. least
  64. .I size
  65. bytes and returns it.
  66. .I Vtlogclose
  67. releases the reference returned by
  68. .IR vtlogopen .
  69. .PP
  70. .I Vtlogprint
  71. writes to
  72. .IR log ,
  73. which must be open.
  74. .PP
  75. .I Vtlog
  76. is a convenient packaging of
  77. .I vtlogopen
  78. followed by
  79. .I vtlogprint
  80. and
  81. .IR vtlogclose .
  82. .PP
  83. .I Vtlogremove
  84. removes the log with the given
  85. .IR name ,
  86. freeing any associated storage.
  87. .PP
  88. .I Vtlognames
  89. returns a list of the names of all the logs.
  90. The length of the list is returned in
  91. .BI * n \fR.
  92. The list
  93. should be freed
  94. by calling
  95. .I vtfree
  96. on the returned pointer.
  97. The strings in the list will be freed by this call as well.
  98. (It is an error to call
  99. .I vtfree
  100. on any of the strings in the list.)
  101. .PP
  102. .I Vtlogdump
  103. prints
  104. .IR log ,
  105. which must be open, to the file descriptor
  106. .IR fd .
  107. .PP
  108. If
  109. .I ventilogging
  110. is set to zero (the default),
  111. .I vtlognames
  112. and
  113. .I vtlogdump
  114. can inspect existing logs, but
  115. .I vtlogopen
  116. always returns nil
  117. and
  118. .I vtlog
  119. is a no-op.
  120. The other functions are no-ops when
  121. passed nil log structures.
  122. .PP
  123. The server library
  124. (see
  125. .IR venti-conn (2)
  126. and
  127. .IR venti-server (2))
  128. writes debugging information to the log named
  129. .IR VtServerLog ,
  130. which defaults to the string
  131. .RB ` libventi/server '.
  132. .SH SOURCE
  133. .B /sys/src/libventi
  134. .SH SEE ALSO
  135. .IR venti (2),
  136. .IR venti (8)