Index: uspace/drv/ns8250/ns8250.c
===================================================================
--- uspace/drv/ns8250/ns8250.c	(revision af6b515772b7e673b3f80cc8621a65997fed0821)
+++ uspace/drv/ns8250/ns8250.c	(revision ebcb05a569ef3a706553a41bd6a44277cc63277f)
@@ -55,4 +55,5 @@
 #include <ddf/driver.h>
 #include <ddf/interrupt.h>
+#include <ddf/log.h>
 #include <ops/char_dev.h>
 
@@ -275,11 +276,11 @@
 static bool ns8250_pio_enable(ns8250_t *ns)
 {
-	printf(NAME ": ns8250_pio_enable %s\n", ns->dev->name);
+	ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s", ns->dev->name);
 	
 	/* Gain control over port's registers. */
 	if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT,
 	    (void **) &ns->port)) {
-		printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
-		    "%s.\n", ns->io_addr, ns->dev->name);
+		ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
+		    " for device %s.", ns->io_addr, ns->dev->name);
 		return false;
 	}
@@ -295,5 +296,5 @@
 static bool ns8250_dev_probe(ns8250_t *ns)
 {
-	printf(NAME ": ns8250_dev_probe %s\n", ns->dev->name);
+	ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name);
 	
 	ioport8_t *port_addr = ns->port;
@@ -313,6 +314,8 @@
 	pio_write_8(port_addr + 4, olddata);
 	
-	if (!res)
-		printf(NAME ": device %s is not present.\n", ns->dev->name);
+	if (!res) {
+		ddf_msg(LVL_DEBUG, "Device %s is not present.",
+		    ns->dev->name);
+	}
 	
 	return res;
@@ -326,5 +329,5 @@
 static int ns8250_dev_initialize(ns8250_t *ns)
 {
-	printf(NAME ": ns8250_dev_initialize %s\n", ns->dev->name);
+	ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ns->dev->name);
 	
 	int ret = EOK;
@@ -337,6 +340,6 @@
 	    IPC_FLAG_BLOCKING);
 	if (ns->dev->parent_phone < 0) {
-		printf(NAME ": failed to connect to the parent driver of the "
-		    "device %s.\n", ns->dev->name);
+		ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
+		    "device %s.", ns->dev->name);
 		ret = ns->dev->parent_phone;
 		goto failed;
@@ -346,6 +349,6 @@
 	ret = hw_res_get_resource_list(ns->dev->parent_phone, &hw_resources);
 	if (ret != EOK) {
-		printf(NAME ": failed to get hw resources for the device "
-		    "%s.\n", ns->dev->name);
+		ddf_msg(LVL_ERROR, "Failed to get HW resources for device "
+		    "%s.", ns->dev->name);
 		goto failed;
 	}
@@ -362,5 +365,5 @@
 			ns->irq = res->res.interrupt.irq;
 			irq = true;
-			printf(NAME ": the %s device was asigned irq = 0x%x.\n",
+			ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.",
 			    ns->dev->name, ns->irq);
 			break;
@@ -369,13 +372,13 @@
 			ns->io_addr = res->res.io_range.address;
 			if (res->res.io_range.size < REG_COUNT) {
-				printf(NAME ": i/o range assigned to the device "
-				    "%s is too small.\n", ns->dev->name);
+				ddf_msg(LVL_ERROR, "I/O range assigned to "
+				    "device %s is too small.", ns->dev->name);
 				ret = ELIMIT;
 				goto failed;
 			}
 			ioport = true;
-			printf(NAME ": the %s device was asigned i/o address = "
-			    "0x%x.\n", ns->dev->name, ns->io_addr);
-			break;
+			ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = "
+			    "0x%x.", ns->dev->name, ns->io_addr);
+    			break;
 			
 		default:
@@ -385,5 +388,5 @@
 	
 	if (!irq || !ioport) {
-		printf(NAME ": missing hw resource(s) for the device %s.\n",
+		ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.",
 		    ns->dev->name);
 		ret = ENOENT;
@@ -470,6 +473,6 @@
 	
 	if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
-		printf(NAME ": error - somebody tried to set invalid baud rate "
-		    "%d\n", baud_rate);
+		ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.",
+		    baud_rate);
 		return EINVAL;
 	}
@@ -654,9 +657,9 @@
 			if (ns->client_connected) {
 				if (!buf_push_back(&ns->input_buffer, val)) {
-					printf(NAME ": buffer overflow on "
-					    "%s.\n", ns->dev->name);
+					ddf_msg(LVL_WARN, "Buffer overflow on "
+					    "%s.", ns->dev->name);
 				} else {
-					printf(NAME ": the character %c saved "
-					    "to the buffer of %s.\n",
+					ddf_msg(LVL_DEBUG2, "Character %c saved "
+					    "to the buffer of %s.",
 					    val, ns->dev->name);
 				}
@@ -714,5 +717,5 @@
 	int rc;
 	
-	printf(NAME ": ns8250_add_device %s (handle = %d)\n",
+	ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)",
 	    dev->name, (int) dev->handle);
 	
@@ -749,5 +752,5 @@
 	/* Register interrupt handler. */
 	if (ns8250_register_interrupt_handler(ns) != EOK) {
-		printf(NAME ": failed to register interrupt handler.\n");
+		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
 		rc = EADDRNOTAVAIL;
 		goto fail;
@@ -757,6 +760,6 @@
 	rc = ns8250_interrupt_enable(ns);
 	if (rc != EOK) {
-		printf(NAME ": failed to enable the interrupt. Error code = "
-		    "%d.\n", rc);
+		ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
+		    "%d.", rc);
 		goto fail;
 	}
@@ -764,5 +767,5 @@
 	fun = ddf_fun_create(dev, fun_exposed, "a");
 	if (fun == NULL) {
-		printf(NAME ": error creating function.\n");
+		ddf_msg(LVL_ERROR, "Failed creating function.");
 		goto fail;
 	}
@@ -772,5 +775,5 @@
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
-		printf(NAME ": error binding function.\n");
+		ddf_msg(LVL_ERROR, "Failed binding function.");
 		goto fail;
 	}
@@ -780,5 +783,5 @@
 	ddf_fun_add_to_class(fun, "serial");
 	
-	printf(NAME ": the %s device has been successfully initialized.\n",
+	ddf_msg(LVL_NOTE, "Device %s successfully initialized.",
 	    dev->name);
 	
@@ -862,6 +865,6 @@
 	fibril_mutex_unlock(&data->mutex);
 	
-	printf(NAME ": ns8250_get_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d\n", *baud_rate, *parity, *word_length,
+	ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word "
+	    "length %d, stop bits %d", *baud_rate, *parity, *word_length,
 	    *stop_bits);
 }
@@ -879,6 +882,6 @@
     unsigned int parity, unsigned int word_length, unsigned int stop_bits)
 {
-	printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d\n", baud_rate, parity, word_length,
+	ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word "
+	    "length %d, stop bits %d", baud_rate, parity, word_length,
 	    stop_bits);
 	
@@ -940,4 +943,6 @@
 static void ns8250_init(void)
 {
+	ddf_log_init(NAME, LVL_ERROR);
+	
 	ns8250_dev_ops.open = &ns8250_open;
 	ns8250_dev_ops.close = &ns8250_close;
