Add nice logs
diff --git a/src/kernel/Jmk b/src/kernel/Jmk
index 3b718b8..8beb214 100644
--- a/src/kernel/Jmk
+++ b/src/kernel/Jmk
@@ -27,7 +27,7 @@
 
 LDFLAGS += -Tlink.ld -melf_i386
 ASMFLAGS += -felf -Fdwarf
-QEMUFLAGS = -d cpu_reset -hda hd0_$(FS).img
+QEMUFLAGS = -hda hd0_$(FS).img
 
 OBJECTS = 	boot.o \
 			main.o \
@@ -63,7 +63,7 @@
 	qemu-system-i386 -s -S -kernel kernel.elf
 
 debug: kernel.elf
-	qemu-system-i386 -s -S -kernel kernel.elf &
+	qemu-system-i386 -s -S $(QEMUFLAGS) -kernel kernel.elf &
 	@echo run "target remote localhost:1234" to connect to qemu
 	gdb $<
 	@pkill qemu-system-i38
@@ -74,7 +74,7 @@
 	@$(patsubst hd0_%.img,mkfs.%,$@) $@
 
 qemu: kernel.elf hd0_$(FS).img
-	qemu-system-i386 $(QEMUFLAGS) -monitor stdio -kernel kernel.elf -no-reboot
+	qemu-system-i386 $(QEMUFLAGS) -d cpu_reset -monitor stdio -kernel kernel.elf -no-reboot
 
 qemu-iso: install
 	qemu-system-i386 $(QEMUFLAGS) -monitor stdio $(ROOT)/bin/bluejay.iso
@@ -84,9 +84,9 @@
 
 mount: hd0_$(FS).img
 	status_log(MOUNT, $^ $(ROOT)/mnt)
-	@if [ $(whoami) = root ]; then echo "DON'T RUN THIS AS ROOT" && exit 1; fi
+	@if [ "$(whoami)" = root ]; then echo "DON'T RUN THIS AS ROOT" && exit 1; fi
 	@mkdir -p $(ROOT)/mnt
-	@sudo mount $^ $(ROOT)/mnt -o rw,uid=$$(id -u),gid=$$(id -g)
+	@mount $^ $(ROOT)/mnt
 
 umount:
 	status_log(UMOUNT, $(ROOT)/mnt)
diff --git a/src/kernel/alloc.c b/src/kernel/alloc.c
index e3c85b1..9c08098 100644
--- a/src/kernel/alloc.c
+++ b/src/kernel/alloc.c
@@ -290,13 +290,13 @@
 	for (int i = 0; i < 12; i++)
 		array[i] = i;
 
-	kprintf("Allocated one, two, array[3] = %d, %d, %d\n", *one, *two,
+	kprintf(DEBUG "Allocated one, two, array[3] = %d, %d, %d\n", *one, *two,
 			array[3]);
-	kprintf("[%x, %x, %x]\n", one, two, array);
+	kprintf(DEBUG "[%x, %x, %x]\n", one, two, array);
 
-	kprintf("Freeing two\n");
+	kprintf(DEBUG "Freeing two\n");
 	free(two);
 	int *four = malloc(sizeof(int));
 	*four = 4;
-	kprintf("Allocated four = %d (%x)\n", *four, four);
+	kprintf(DEBUG "Allocated four = %d (%x)\n", *four, four);
 }
diff --git a/src/kernel/dri/ata_pio/ata_pio.c b/src/kernel/dri/ata_pio/ata_pio.c
index db1b7cb..cf55b51 100644
--- a/src/kernel/dri/ata_pio/ata_pio.c
+++ b/src/kernel/dri/ata_pio/ata_pio.c
@@ -76,7 +76,7 @@
 
 void test_ata_pio()
 {
-	kprintf("Going to ata_pio_read_sectors\n");
+	kprintf(INFO "Going to ata_pio_read_sectors\n");
 
 	ata_pio_read_sectors(test_buffer, 0, 1);
 	print_buffer();
diff --git a/src/kernel/dri/fs/ext2/ext2.c b/src/kernel/dri/fs/ext2/ext2.c
index 31ed7fe..d0dd3bd 100644
--- a/src/kernel/dri/fs/ext2/ext2.c
+++ b/src/kernel/dri/fs/ext2/ext2.c
@@ -16,5 +16,12 @@
 {
 	struct ext2_superblock sb = ext2_read_superblock();
 
-	kprintf("Magic = 0x%x\n", sb.signature);
+	kprintf(INFO "EXT2 magic = 0x%x\n", sb.signature);
 }
+
+bool ext2_valid_filesystem()
+{
+	struct ext2_superblock sb = ext2_read_superblock();
+
+	return sb.signature == EXT2_SIGNATURE;
+}
\ No newline at end of file
diff --git a/src/kernel/dri/ide/ide.c b/src/kernel/dri/ide/ide.c
index 21f2651..0025970 100644
--- a/src/kernel/dri/ide/ide.c
+++ b/src/kernel/dri/ide/ide.c
@@ -16,12 +16,12 @@
 
 void ide_print_device(struct ide_device *dev)
 {
-    kprintf("<ide-device dma=%b>", dev->supports_dma);
+    kprintf(INFO "<ide-device dma=%b>", dev->supports_dma);
 }
 
 void ide_thread(struct ide_thread_data *data)
 {
-    kprintf("IDE driver thread starting: device=0x%x\n", data->dev.device_id);
+    kprintf(DEBUG "IDE driver thread starting: device=0x%x\n", data->dev.device_id);
 
     struct ide_device dev;
 
diff --git a/src/kernel/dri/pci/pci.c b/src/kernel/dri/pci/pci.c
index 6d35edc..4d2d01e 100644
--- a/src/kernel/dri/pci/pci.c
+++ b/src/kernel/dri/pci/pci.c
@@ -67,7 +67,7 @@
 
 void pci_print_devices()
 {
-	kprintf("Enumerating PCI devices:\n");
+	kprintf(INFO "Enumerating PCI devices:\n");
 	for (int bus = 0; bus < 0xff; bus++)
 	{
 		for (int slot = 0; slot < 32; slot++)
@@ -78,7 +78,7 @@
 
 				if (dev.valid)
 				{
-					kprintf("%d %d %d --- d:0x%x --- %d:%d:%d --- %s\n", bus,
+					kprintf(INFO "%d %d %d --- d:0x%x --- %d:%d:%d --- %s\n", bus,
 							slot, func, dev.device_id, dev.class, dev.subclass,
 							dev.prog_if, dev.vendor->name);
 				}
@@ -134,13 +134,13 @@
 
 void pci_print_drivers()
 {
-	kprintf("Enumerating PCI device drivers:\n");
+	kprintf(INFO "Enumerating PCI device drivers:\n");
 	for (int i = 0; i < num_drivers; i++)
 	{
 		for (int j = 0; j < drivers[i].loaded; j++)
 		{
 			struct pci_device_driver d = drivers[i];
-			kprintf("Driver: %s, vendor: %s\n", d.generic_name, d.dev.vendor->name);
+			kprintf(INFO "Driver: %s, vendor: %s\n", d.generic_name, d.dev.vendor->name);
 		}
 	}
 }
diff --git a/src/kernel/faults.c b/src/kernel/faults.c
index ba5a615..e7c4180 100644
--- a/src/kernel/faults.c
+++ b/src/kernel/faults.c
@@ -4,7 +4,7 @@
 #define DECLARE_INTERRUPT(sym, name)                                           \
 	static void sym##_h(struct registers *regs)                                \
 	{                                                                          \
-		kprintf("Fault " name ": eip = 0x%x, err = 0x%x\n", regs->eip,         \
+		kprintf(ERROR "Fault " name ": eip = 0x%x, err = 0x%x\n", regs->eip,   \
 				regs->error_code);                                             \
 		asm volatile("cli");                                                   \
 		kpanic(name);                                                          \
diff --git a/src/kernel/io.c b/src/kernel/io.c
index 90a365c..c53ef17 100644
--- a/src/kernel/io.c
+++ b/src/kernel/io.c
@@ -124,3 +124,21 @@
 	memset(pressed_keys, 0, LAST_KBD_KEY);
 	add_interrupt_handler(33, kbd_handle_input);
 }
+
+bool isdigit(char c)
+{
+	return c >= '0' && c <= '9';
+}
+
+uint parse_int(char *string)
+{
+	uint number = 0;
+
+	for (; isdigit(*string); string++)
+	{
+		number *= 10;
+		number += *string - '0';
+	}
+
+	return number;
+}
diff --git a/src/kernel/log.c b/src/kernel/log.c
index 11ce505..ff22727 100644
--- a/src/kernel/log.c
+++ b/src/kernel/log.c
@@ -66,7 +66,7 @@
 	if (!condition)
 	{
 		vga_set_color(LIGHT_RED, BLACK);
-		kprintf("ASSERTION FAILED: %s:%d\n%s\n", file, line, message);
+		kprintf(ERROR "ASSERTION FAILED: %s:%d\n%s\n", file, line, message);
 
 		while (1)
 		{
diff --git a/src/kernel/main.c b/src/kernel/main.c
index 0fef9c5..04dc9a7 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -17,15 +17,15 @@
 
 void greet()
 {
-	kprintf("Hello from get_task_id() = %d, get_process_id() = %d\n",
+	kprintf(DEBUG "Hello from get_task_id() = %d, get_process_id() = %d\n",
 			get_task_id(), get_process_id());
 }
 
 void other_thread(size_t data)
 {
-	kprintf("data is 0x%x\n", data);
+	kprintf(DEBUG "data is 0x%x\n", data);
 	greet();
-	kprintf("Returning from other_thread\n");
+	kprintf(DEBUG "Returning from other_thread\n");
 
 	return;
 }
@@ -52,27 +52,25 @@
 
 #ifdef INITRD
 	kassert(mb.mods_count, "No multiboot modules loaded!");
-	kprintf("mboot->mods_addr = %d (0x%x)\n", mb.mods_addr, mb.mods_addr);
+	kprintf(DEBUG "mboot->mods_addr = %d (0x%x)\n", mb.mods_addr, mb.mods_addr);
 	uchar *initrd_loc = (uchar *)((uint *)mb.mods_addr)[0];
 
-	kprintf("initrd is at 0x%x to 0x%x\n", initrd_loc);
+	kprintf(DEBUG "initrd is at 0x%x to 0x%x\n", initrd_loc);
 
 	init_initrd_vfs(initrd_loc);
 #endif
 
-	kprintf("VFS initialized\n");
+	kprintf(OKAY "VFS initialized\n");
 
-	vga_set_color(LIGHT_GREEN, BLACK);
-	kprintf("Setup complete!\n");
-	vga_set_color(WHITE, BLACK);
+	kprintf(OKAY "Initial setup complete!\n");
 
 #ifdef TEST_VFS_INITRD
-	kprintf("fs_readdir(\"/dev/initrd\")\n");
+	kprintf(INFO "fs_readdir(\"/dev/initrd\")\n");
 
 	struct fs_dirent dirent;
 	for (int i = 0; fs_readdir(&root, i, &dirent); i++)
 	{
-		kprintf("name: %s, inode: %d\n", dirent.name, dirent.inode);
+		kprintf(INFO "name: %s, inode: %d\n", dirent.name, dirent.inode);
 	}
 #endif
 
@@ -86,6 +84,8 @@
 
 	pci_load();
 
+	kprintf(OKAY "Loaded PCI devices\n");
+
 #ifdef TEST_THREADS
 	spawn_thread(other_thread, NULL);
 
@@ -101,7 +101,13 @@
 	test_ata_pio();
 #endif
 
-	ext2_mount(&root);
+#ifdef TEST_EXT2
+	if (ext2_valid_filesystem())
+	{
+		kprintf(INFO "Mounting EXT2 to /\n");
+		ext2_mount(&root);
+	}
+#endif
 
 	while (true)
 		asm("hlt");
diff --git a/src/kernel/multiboot.c b/src/kernel/multiboot.c
index d69f56c..3170472 100644
--- a/src/kernel/multiboot.c
+++ b/src/kernel/multiboot.c
@@ -14,7 +14,7 @@
 	TO_VIRT(mb.mods_addr, uint);
 	TO_VIRT(mb.cmdline, char);
 
-	kprintf("mb.mods_addr = %d, 0x%x\n", mb.mods_addr, mb.mods_addr);
+	kprintf(DEBUG "mb.mods_addr = %d, 0x%x\n", mb.mods_addr, mb.mods_addr);
 	kassert((size_t)mb.mods_addr >= 0xc0000000, "mb.mods_addr PHYSICAL");
 	for (int i = 0; i < mb.mods_count + 1; i++)
 	{
diff --git a/src/kernel/paging.c b/src/kernel/paging.c
index 536fdef..50ee738 100644
--- a/src/kernel/paging.c
+++ b/src/kernel/paging.c
@@ -51,7 +51,7 @@
 			{
 				/* found unused frame */
 				uint frame = i * BITS + j;
-				kprintf("first_free_frame returning %d\n", frame);
+				kprintf(DEBUG "first_free_frame returning %d\n", frame);
 //				kpanic("asdf");
 				return frame;
 			}
@@ -68,7 +68,7 @@
 		return; /* frame already allocated */
 
 	uint frame = first_free_frame();
-	//	kprintf("first_free_frame found %d\n", frame);
+	//	kprintf(DEBUG "first_free_frame found %d\n", frame);
 	set_frame(frame * 0x1000); /* mark as mapped */
 	*page_table_entry = frame | 1 | writable << 1 | user << 2;
 }
@@ -130,12 +130,12 @@
 	// Page number % pages per table
 	uint page = ((size_t)virt / 0x1000) % 1024;
 	uint *table = get_or_create_table(dir, (size_t)virt >> 22, false, false);
-	kprintf("table = 0x%x (virt)\n", table);
-	kprintf("dir entry = 0x%x\n", dir[(size_t)virt >> 22]);
+	kprintf(DEBUG "table = 0x%x (virt)\n", table);
+	kprintf(DEBUG "dir entry = 0x%x\n", dir[(size_t)virt >> 22]);
 
 	alloc_frame(&table[page], false, false);
 
-	kprintf("alloc_page table[page] = %d (0x%x)\n", table[page], table[page]);
+	kprintf(DEBUG "alloc_page table[page] = %d (0x%x)\n", table[page], table[page]);
 	return;
 }
 
@@ -183,6 +183,6 @@
 
 void page_fault(struct registers *regs)
 {
-	kprintf("Page fault! eip = %d\n", regs->eip);
+	kprintf(ERROR "Page fault! eip = %d\n", regs->eip);
 	kpanic("Page fault");
 }
diff --git a/src/kernel/pic.c b/src/kernel/pic.c
index a9a06ef..5d33213 100644
--- a/src/kernel/pic.c
+++ b/src/kernel/pic.c
@@ -33,7 +33,7 @@
 	if (interrupt_handlers[regs.interrupt_number])
 		interrupt_handlers[regs.interrupt_number](&regs);
 	else
-		kprintf("Unhandled hardware interrupt: %d, called from %d\n", regs.interrupt_number, regs.eip);
+		kprintf(ERROR "Unhandled hardware interrupt: %d, called from %d\n", regs.interrupt_number, regs.eip);
 }
 
 void isr_handler(struct registers regs)
@@ -41,7 +41,7 @@
 	if (interrupt_handlers[regs.interrupt_number])
 		interrupt_handlers[regs.interrupt_number](&regs);
 	else
-		kprintf("Unhandled interrupt: %d, called from %d\n", regs.interrupt_number, regs.eip);
+		kprintf(ERROR "Unhandled interrupt: %d, called from %d\n", regs.interrupt_number, regs.eip);
 }
 
 void add_interrupt_handler(uchar interrupt, void (*handler)(struct registers *))
diff --git a/src/kernel/syscall.c b/src/kernel/syscall.c
index 6877e63..5a48b30 100644
--- a/src/kernel/syscall.c
+++ b/src/kernel/syscall.c
@@ -4,7 +4,7 @@
 
 void do_syscall(struct registers *regs)
 {
-	kprintf("Syscall executed: %d\n", regs->eax);
+	kprintf(INFO "Syscall executed: %d\n", regs->eax);
 }
 
 void init_syscall()
diff --git a/src/kernel/vfs_initrd.c b/src/kernel/vfs_initrd.c
index cad6d0b..bca0b50 100644
--- a/src/kernel/vfs_initrd.c
+++ b/src/kernel/vfs_initrd.c
@@ -81,7 +81,7 @@
 
 	if (h->magic != INITRD_MAGIC)
 	{
-		kprintf("initrd magic is wrong: %x should be %x\n", h->magic,
+		kprintf(ERROR "initrd magic is wrong: %x should be %x\n", h->magic,
 				INITRD_MAGIC);
 		kpanic("initrd magic");
 	}
diff --git a/src/kernel/vga.c b/src/kernel/vga.c
index 49c2701..394d9c8 100644
--- a/src/kernel/vga.c
+++ b/src/kernel/vga.c
@@ -6,10 +6,15 @@
 static uint cursor_x = 0;
 static uint cursor_y = 0;
 
-static ushort color = WHITE;
+static uchar color = WHITE;
 
 static ushort *fb = (ushort *)PHYS_TO_VIRT(0xB8000);
 
+#define BUFFER_SIZE 16
+static char buffer[BUFFER_SIZE];
+static uint buffer_index = 0;
+static bool in_escape = false;
+
 static void move_cursor()
 {
 	ushort pos = cursor_y * 80 + cursor_x;
@@ -43,8 +48,72 @@
 	color = (bg << 4) | (fg & 0xf);
 }
 
+void got_escape()
+{
+	if (buffer[0] != '[')
+		return;
+
+	int c = parse_int(buffer+1);
+
+	static const char ansi_to_vga_colors[] =
+	{
+		[30] = BLACK,
+		RED,
+		GREEN,
+		LIGHT_BROWN,
+		BLUE,
+		MAGENTA,
+		CYAN,
+		WHITE,
+		[90] = LIGHT_GREY,
+		LIGHT_RED,
+		LIGHT_GREEN,
+		LIGHT_BROWN,
+		LIGHT_BLUE,
+		LIGHT_MAGENTA,
+		LIGHT_CYAN,
+		WHITE,
+	};
+
+	if (c == 0)
+	{
+		color = WHITE;
+	}
+	else if ((c >= 30 && c <= 37) || (c >= 90 && c <= 97))
+	{
+		color &= 0xf0;
+		color |= ansi_to_vga_colors[c];
+	}
+	else if ((c >= 40 && c <= 47) || (c >= 100 && c <= 107))
+	{
+		color &= 0x0f;
+		color |= ansi_to_vga_colors[c - 10] << 4;
+	}
+}
+
 void vga_put(char c)
 {
+	if (in_escape)
+	{
+		if (buffer_index >= BUFFER_SIZE || c == 'm')
+		{
+			// For now we are only supporting color escape sequences.
+			if (c == 'm')
+				got_escape();
+
+			// Escape sequence is too long, sorry. Failing silently.
+			in_escape = false;
+			buffer_index = 0;
+			memset(buffer, 0, sizeof(buffer));
+		}
+		else
+		{
+			buffer[buffer_index++] = c;
+		}
+
+		return;
+	}
+
 	switch (c)
 	{
 	case '\b':
@@ -60,6 +129,9 @@
 	case '\r':
 		cursor_x = 0;
 		break;
+	case 033:
+		in_escape = true;
+		break;
 	default:
 		fb[cursor_y * 80 + cursor_x] = c | (color << 8);
 		cursor_x++;