[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] libsvn_repos logging API -- 3rd draft

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2005-07-15 20:52:29 CEST

Well, now the patch is much smaller and simpler, based on the other
design thread. We'll move all the errorlogging/loglevel stuff into
svnserve's private codebase later on. For now, we have nothing but a
per-repository accesslog, shareable by different types of servers:

Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 15345)
+++ subversion/include/svn_repos.h (working copy)
@@ -25,6 +25,7 @@
#include <apr_pools.h>
#include <apr_hash.h>
+#include <apr_network_io.h>
#include "svn_fs.h"
#include "svn_delta.h"
#include "svn_types.h"
@@ -1702,6 +1703,69 @@
                                svn_boolean_t *access_granted,
                                apr_pool_t *pool);
+
+
+/* ---------------------------------------------------------------*/
+

+/**
+ * @defgroup svn_repos_logging Repository access logging
+ * @{
+ *
+ * @since New in 1.3.
+ */
+
+
+/** Identify the user of @a repos as @a processname. */
+void
+svn_repos_set_processname (svn_repos_t *repos,
+ const char *processname);
+
+/** Set @a *processname to the name of the process using @a repos, or
+ NULL if none is defined. */
+void
+svn_repos_get_processname (const char **processname,
+ svn_repos_t *repos);
+
+/** Have @a repos write all accesslog messages to @a logfile. */
+void
+svn_repos_set_accesslog (svn_repos_t *repos,
+ svn_stream_t *logfile);
+
+/** Set @a *logfile to the current accesslog of @a repos, or NULL if
+ none is defined. */
+void
+svn_repos_get_accesslog (svn_stream_t **logfile,
+ svn_repos_t *repos);
+
+
+/** Write a message into the accesslog of @a repos, using a
+ * printf-style error message produced by passing @a fmt to @c
+ * apr_psprintf.
+ *
+ * If the name of the process using @a repos is not @c NULL, then log
+ * it as well. (See @c svn_repos_set_processname.)
+ *
+ * If not @c NULL, then log @a sockaddr as the incoming IP address of
+ * the request.
+ *
+ * If not @c NULL, then log @a username as the user performing the
+ * request.
+ *
+ * Use @a pool for any temporary memory allocation, including possibly
+ * calling apr_psprintf() to format the message.
+ */
+void
+svn_repos_write_accesslog (svn_repos_t *repos,
+ apr_pool_t *pool,
+ apr_sockaddr_t *sockaddr,
+ const char *username,
+ const char *fmt,
+ ...);
+
+
+/** @} */
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 15 20:55:07 2005

This is an archived mail posted to the Subversion Dev mailing list.