git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] git-daemon: single-line logs
@ 2009-01-14 10:48 Jan Engelhardt
  2009-01-14 10:48 ` [PATCH 2/3] git-daemon: use getnameinfo to resolve hostname Jan Engelhardt
  2009-01-14 11:33 ` [PATCH 1/3] git-daemon: single-line logs Junio C Hamano
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Engelhardt @ 2009-01-14 10:48 UTC (permalink / raw)
  To: git



parent v1.6.1

git-daemon: single-line logs

Having just a single line per connection attempt, much like Apache
httpd2 access logs, makes log parsing much easier, especially when
just glancing over it non-automated.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>

---
 daemon.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Index: git-1.6.1/daemon.c
===================================================================
--- git-1.6.1.orig/daemon.c
+++ git-1.6.1/daemon.c
@@ -295,12 +295,13 @@ static int git_daemon_config(const char
 	return 0;
 }
 
-static int run_service(char *dir, struct daemon_service *service)
+static int run_service(char *dir, struct daemon_service *service,
+    const char *origin, const char *vhost)
 {
 	const char *path;
 	int enabled = service->enabled;
 
-	loginfo("Request %s for '%s'", service->name, dir);
+	loginfo("%s->%s %s \"%s\"\n", origin, vhost, service->name, dir);
 
 	if (!enabled && !service->overridable) {
 		logerror("'%s': service not enabled.", service->name);
@@ -507,10 +508,10 @@ static void parse_extra_args(char *extra
 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) {
@@ -529,7 +530,6 @@ static int execute(struct sockaddr *addr
 			port = ntohs(sin6_addr->sin6_port);
 #endif
 		}
-		loginfo("Connection from %s:%d", addrbuf, port);
 		setenv("REMOTE_ADDR", addrbuf, 1);
 	}
 	else {
@@ -541,10 +541,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--;
@@ -569,7 +565,8 @@ static int execute(struct sockaddr *addr
 			 * Note: The directory here is probably context sensitive,
 			 * and might depend on the actual service being performed.
 			 */
-			return run_service(line + namelen + 5, s);
+			return run_service(line + namelen + 5, s,
+			       addrbuf, hostname);
 		}
 	}
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-01-14 19:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 10:48 [PATCH 1/3] git-daemon: single-line logs Jan Engelhardt
2009-01-14 10:48 ` [PATCH 2/3] git-daemon: use getnameinfo to resolve hostname Jan Engelhardt
2009-01-14 10:49   ` [PATCH 3/3] git-daemon: vhost support Jan Engelhardt
2009-01-14 11:33     ` Junio C Hamano
2009-01-14 13:15       ` Jan Engelhardt
2009-01-14 11:33   ` [PATCH 2/3] git-daemon: use getnameinfo to resolve hostname Junio C Hamano
2009-01-14 13:06     ` Jan Engelhardt
2009-01-14 12:25   ` Jeff King
2009-01-14 14:17     ` Adeodato Simó
2009-01-14 14:22     ` Jay Soffian
2009-01-14 19:25     ` [2/3] " Jan Engelhardt
2009-01-14 11:33 ` [PATCH 1/3] git-daemon: single-line logs Junio C Hamano
2009-01-14 13:03   ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).