disable logging
diff --git a/src/libventi/log.c b/src/libventi/log.c
index fdf6cee..511a7f2 100644
--- a/src/libventi/log.c
+++ b/src/libventi/log.c
@@ -2,8 +2,11 @@
 #include <libc.h>
 #include <venti.h>
 
+int ventilogging;
 #define log	not_the_log_library_call
 
+static char Eremoved[] = "[removed]";
+
 enum
 {	/* defaults */
 	LogChunkSize = 8192,
@@ -35,6 +38,9 @@
 	char *p;
 	VtLog *l, *last;
 
+	if(!ventilogging)
+		return nil;
+
 	h = hash(name)%nelem(vl.hash);
 	qlock(&vl.lk);
 	last = nil;
@@ -65,6 +71,7 @@
 	p = (char*)(l->chunk+nc);
 	for(i=0; i<nc; i++){
 		l->chunk[i].p = p;
+		l->chunk[i].wp = p;
 		p += LogChunkSize;
 		l->chunk[i].ep = p;
 	}
@@ -74,6 +81,7 @@
 	/* insert */
 	l->next = vl.hash[h];
 	vl.hash[h] = l;
+	l->ref++;
 	
 	l->ref++;
 	qunlock(&vl.lk);
@@ -87,9 +95,11 @@
 		return;
 
 	qlock(&vl.lk);
-	if(--l->ref == 0)
+	if(--l->ref == 0){
+		/* must not be in hash table */
+		assert(l->name == Eremoved);
 		free(l);
-	else
+	}else
 		assert(l->ref > 0);
 	qunlock(&vl.lk);
 }
@@ -109,6 +119,8 @@
 				last->next = l->next;
 			else
 				vl.hash[h] = l->next;
+			l->name = Eremoved;
+			l->next = nil;
 			qunlock(&vl.lk);
 			vtlogclose(l);
 			return;
@@ -116,16 +128,35 @@
 	qunlock(&vl.lk);
 }
 
+static int
+timefmt(Fmt *fmt)
+{
+	static uvlong t0;
+	uvlong t;
+
+	if(t0 == 0)
+		t0 = nsec();
+	t = nsec()-t0;
+	return fmtprint(fmt, "T+%d.%04d", (uint)(t/1000000000), (uint)(t%1000000000)/100000);
+}
+
 void
 vtlogvprint(VtLog *l, char *fmt, va_list arg)
 {
 	int n;
 	char *p;
 	VtLogChunk *c;
+	static int first = 1;
 
 	if(l == nil)
 		return;
 		
+	if(first){
+		fmtinstall('T', timefmt);
+		first = 0;
+	}
+		
+	
 	qlock(&l->lk);
 	c = l->w;
 	n = c->ep - c->wp;
@@ -160,8 +191,10 @@
 {
 	VtLog *l;
 	va_list arg;
-	
+
 	l = vtlogopen(name, LogSize);
+	if(l == nil)
+		return;
 	va_start(arg, fmt);
 	vtlogvprint(l, fmt, arg);
 	va_end(arg);
@@ -183,6 +216,5 @@
 			c = l->chunk;
 		write(fd, c->p, c->wp-c->p);
 	}
-	vtlogclose(l);
 }