Hi, I wrote this patch for my git-daemon to make it much easier to parse /var/log/git-daemon.log -- namely reducing the output from three lines per connected client to just one. commit 4dc99ff38c7e09aabf253bd9f65e8b4958654f7e against v1.6.0.4 Author: Jan Engelhardt <jengelh@xxxxxxxxxx> Date: Sun Aug 24 12:12:29 2008 -0400 git-daemon: single-line logs Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx> --- daemon.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/daemon.c b/daemon.c index 8dcde73..8ecfe7b 100644 --- a/daemon.c +++ b/daemon.c @@ -319,14 +319,15 @@ static int git_daemon_config(const char *var, const char *value, void *cb) return 0; } -static int run_service(struct interp *itable, struct daemon_service *service) +static int run_service(struct interp *itable, struct daemon_service *service, + const char *origin) { const char *path; int enabled = service->enabled; - loginfo("Request %s for '%s'", - service->name, - itable[INTERP_SLOT_DIR].value); + loginfo("%s->%s %s \"%s\"\n", + origin, itable[INTERP_SLOT_HOST].value, + service->name, itable[INTERP_SLOT_DIR].value); if (!enabled && !service->overridable) { logerror("'%s': service not enabled.", service->name); @@ -534,10 +535,10 @@ static void fill_in_extra_table_entries(struct interp *itable) static int execute(struct sockaddr *addr) { static char line[1000]; + char addrbuf[256] = ""; int pktlen, len, i; if (addr) { - char addrbuf[256] = ""; int port = -1; if (addr->sa_family == AF_INET) { @@ -556,7 +557,6 @@ static int execute(struct sockaddr *addr) port = ntohs(sin6_addr->sin6_port); #endif } - loginfo("Connection from %s:%d", addrbuf, port); } alarm(init_timeout ? init_timeout : timeout); @@ -564,10 +564,6 @@ static int execute(struct sockaddr *addr) alarm(0); len = strlen(line); - if (pktlen != len) - loginfo("Extended attributes (%d bytes) exist <%.*s>", - (int) pktlen - len, - (int) pktlen - len, line + len + 1); if (len && line[len-1] == '\n') { line[--len] = 0; pktlen--; @@ -596,7 +592,7 @@ static int execute(struct sockaddr *addr) */ interp_set_entry(interp_table, INTERP_SLOT_DIR, line + namelen + 5); - return run_service(interp_table, s); + return run_service(interp_table, s, addrbuf); } } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html