Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision df147c7b4922ea53246e4777ccd2ff6309ec4c7d)
+++ uspace/srv/devman/devman.c	(revision fc51296af4f45da426f5626f3573adee6b0babda)
@@ -34,4 +34,5 @@
 #include <fcntl.h>
 #include <sys/stat.h>
+#include <io/log.h>
 #include <ipc/driver.h>
 #include <ipc/devman.h>
@@ -146,5 +147,5 @@
 	fibril_mutex_unlock(&drivers_list->drivers_mutex);
 
-	printf(NAME": the '%s' driver was added to the list of available "
+	log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
 	    "drivers.\n", drv->name);
 }
@@ -237,5 +238,5 @@
 bool read_match_ids(const char *conf_path, match_id_list_t *ids)
 {
-	printf(NAME ": read_match_ids conf_path = %s.\n", conf_path);
+	log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")\n", conf_path);
 	
 	bool suc = false;
@@ -247,5 +248,6 @@
 	fd = open(conf_path, O_RDONLY);
 	if (fd < 0) {
-		printf(NAME ": unable to open %s\n", conf_path);
+		log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.\n",
+		    conf_path, str_error(fd));
 		goto cleanup;
 	}
@@ -255,5 +257,6 @@
 	lseek(fd, 0, SEEK_SET);
 	if (len == 0) {
-		printf(NAME ": configuration file '%s' is empty.\n", conf_path);
+		log_msg(LVL_ERROR, "Configuration file '%s' is empty.\n",
+		    conf_path);
 		goto cleanup;
 	}
@@ -261,5 +264,5 @@
 	buf = malloc(len + 1);
 	if (buf == NULL) {
-		printf(NAME ": memory allocation failed when parsing file "
+		log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
 		    "'%s'.\n", conf_path);
 		goto cleanup;
@@ -268,5 +271,5 @@
 	ssize_t read_bytes = safe_read(fd, buf, len);
 	if (read_bytes <= 0) {
-		printf(NAME ": unable to read file '%s'.\n", conf_path);
+		log_msg(LVL_ERROR, "Unable to read file '%s'.\n", conf_path);
 		goto cleanup;
 	}
@@ -306,5 +309,5 @@
 bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
 {
-	printf(NAME ": get_driver_info base_path = %s, name = %s.\n",
+	log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")\n",
 	    base_path, name);
 	
@@ -338,5 +341,6 @@
 	struct stat s;
 	if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
-		printf(NAME ": driver not found at path %s.", drv->binary_path);
+		log_msg(LVL_ERROR, "Driver not found at path `%s'.",
+		    drv->binary_path);
 		goto cleanup;
 	}
@@ -365,5 +369,5 @@
 int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
 {
-	printf(NAME ": lookup_available_drivers, dir = %s \n", dir_path);
+	log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")\n", dir_path);
 	
 	int drv_cnt = 0;
@@ -399,5 +403,5 @@
 	dev_node_t *dev;
 	
-	printf(NAME ": create_root_nodes\n");
+	log_msg(LVL_DEBUG, "create_root_nodes()\n");
 	
 	fibril_rwlock_write_lock(&tree->rwlock);
@@ -484,6 +488,6 @@
 void attach_driver(dev_node_t *dev, driver_t *drv)
 {
-	printf(NAME ": attach_driver %s to device %s\n",
-	    drv->name, dev->pfun->pathname);
+	log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")\n",
+	    dev->pfun->pathname, drv->name);
 	
 	fibril_mutex_lock(&drv->driver_mutex);
@@ -507,10 +511,10 @@
 	assert(fibril_mutex_is_locked(&drv->driver_mutex));
 	
-	printf(NAME ": start_driver '%s'\n", drv->name);
+	log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")\n", drv->name);
 	
 	rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
 	if (rc != EOK) {
-		printf(NAME ": error spawning %s (%s)\n",
-		    drv->name, str_error(rc));
+		log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.\n",
+		    drv->name, drv->binary_path, str_error(rc));
 		return false;
 	}
@@ -574,5 +578,6 @@
 	int phone;
 
-	printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
+	log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")\n",
+	    driver->name);
 
 	fibril_mutex_lock(&driver->driver_mutex);
@@ -641,5 +646,5 @@
 	 * immediately and possibly started here as well.
 	 */
-	printf(NAME ": driver %s goes into running state.\n", driver->name);
+	log_msg(LVL_DEBUG, "Driver `%s' enters running state.\n", driver->name);
 	driver->state = DRIVER_RUNNING;
 
@@ -658,5 +663,6 @@
 void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
 {
-	printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
+	log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")\n",
+	    driver->name);
 	
 	/*
@@ -748,6 +754,6 @@
 	 * access any structures that would affect driver_t.
 	 */
-	printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,
-	    dev->pfun->name);
+	log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")\n",
+	    drv->name, dev->pfun->name);
 	
 	sysarg_t rc;
@@ -810,5 +816,5 @@
 	driver_t *drv = find_best_match_driver(drivers_list, dev);
 	if (drv == NULL) {
-		printf(NAME ": no driver found for device '%s'.\n",
+		log_msg(LVL_ERROR, "No driver found for device `%s'.\n",
 		    dev->pfun->pathname);
 		return false;
@@ -848,5 +854,5 @@
 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
 {
-	printf(NAME ": init_device_tree.\n");
+	log_msg(LVL_DEBUG, "init_device_tree()\n");
 	
 	tree->current_handle = 0;
@@ -1027,5 +1033,5 @@
 	fun->pathname = (char *) malloc(pathsize);
 	if (fun->pathname == NULL) {
-		printf(NAME ": failed to allocate device path.\n");
+		log_msg(LVL_ERROR, "Failed to allocate device path.\n");
 		return false;
 	}
@@ -1058,4 +1064,7 @@
 	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
 	
+	log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])\n",
+	    dev, pfun, pfun->pathname);
+
 	/* Add the node to the handle-to-node map. */
 	dev->handle = ++tree->current_handle;
@@ -1064,5 +1073,4 @@
 
 	/* Add the node to the list of its parent's children. */
-	printf("insert_dev_node: dev=%p, dev->pfun := %p\n", dev, pfun);
 	dev->pfun = pfun;
 	pfun->child = dev;
