aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/svnserve/logger.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/svnserve/logger.c')
-rw-r--r--subversion/svnserve/logger.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/subversion/svnserve/logger.c b/subversion/svnserve/logger.c
index 19b6bd48a494..ccd793cbbbcd 100644
--- a/subversion/svnserve/logger.c
+++ b/subversion/svnserve/logger.c
@@ -88,19 +88,21 @@ logger__create(logger_t **logger,
return SVN_NO_ERROR;
}
-void
-logger__log_error(logger_t *logger,
- svn_error_t *err,
- repository_t *repository,
- client_info_t *client_info)
+static void
+log_message(logger_t *logger,
+ const svn_error_t *err,
+ const char *prefix,
+ repository_t *repository,
+ client_info_t *client_info)
{
if (logger && err)
{
const char *timestr, *continuation;
const char *user, *repos, *remote_host;
- char errbuf[256];
+
/* 8192 from MAX_STRING_LEN in from httpd-2.2.4/include/httpd.h */
- char errstr[8192];
+ const apr_size_t errstr_size = 8192;
+ char *errstr = apr_palloc(logger->pool, errstr_size);
svn_error_clear(svn_mutex__lock(logger->mutex));
@@ -118,21 +120,22 @@ logger__log_error(logger_t *logger,
continuation = "";
while (err)
{
+ char errbuf[256];
const char *message = svn_err_best_message(err, errbuf, sizeof(errbuf));
/* based on httpd-2.2.4/server/log.c:log_error_core */
- apr_size_t len = apr_snprintf(errstr, sizeof(errstr),
+ apr_size_t len = apr_snprintf(errstr, errstr_size,
"%" APR_PID_T_FMT
- " %s %s %s %s ERR%s %s %ld %d ",
+ " %s %s %s %s %s%s %s %ld %d ",
getpid(), timestr, remote_host, user,
- repos, continuation,
+ repos, prefix, continuation,
err->file ? err->file : "-", err->line,
err->apr_err);
len += escape_errorlog_item(errstr + len, message,
- sizeof(errstr) - len);
+ errstr_size - len);
/* Truncate for the terminator (as apr_snprintf does) */
- if (len > sizeof(errstr) - sizeof(APR_EOL_STR)) {
- len = sizeof(errstr) - sizeof(APR_EOL_STR);
+ if (len > errstr_size - sizeof(APR_EOL_STR)) {
+ len = errstr_size - sizeof(APR_EOL_STR);
}
memcpy(errstr + len, APR_EOL_STR, sizeof(APR_EOL_STR));
@@ -150,6 +153,24 @@ logger__log_error(logger_t *logger,
}
}
+void
+logger__log_error(logger_t *logger,
+ const svn_error_t *err,
+ repository_t *repository,
+ client_info_t *client_info)
+{
+ log_message(logger, err, "ERR", repository, client_info);
+}
+
+void
+logger__log_warning(logger_t *logger,
+ const svn_error_t *err,
+ repository_t *repository,
+ client_info_t *client_info)
+{
+ log_message(logger, err, "WARN", repository, client_info);
+}
+
svn_error_t *
logger__write(logger_t *logger,
const char *errstr,