Index: uspace/srv/logger/namespace.c
===================================================================
--- uspace/srv/logger/namespace.c	(revision 669f5caed8b5063907bbb28370a6c9ceccd1455e)
+++ uspace/srv/logger/namespace.c	(revision 6e9e12bf4a25204c6bf8d4458fa8680fd08c2e59)
@@ -44,40 +44,14 @@
 	fibril_mutex_t guard;
 	size_t writers_count;
-	fibril_condvar_t reader_appeared_cv;
-	bool has_reader;
+	fibril_condvar_t level_changed_cv;
 	FILE *logfile;
-	log_level_t logfile_level;
+	log_level_t level;
 	const char *name;
+
 	link_t link;
-	prodcons_t messages;
 };
 
 static FIBRIL_MUTEX_INITIALIZE(namespace_list_guard);
 static LIST_INITIALIZE(namespace_list);
-
-log_message_t *message_create(const char *name, log_level_t level)
-{
-	log_message_t *message = malloc(sizeof(log_message_t));
-	if (message == NULL)
-		return NULL;
-
-	message->message = str_dup(name);
-	if (message->message == NULL) {
-		free(message);
-		return NULL;
-	}
-
-	message->level = level;
-	link_initialize(&message->link);
-
-	return message;
-}
-
-void message_destroy(log_message_t *message)
-{
-	assert(message);
-	free(message->message);
-	free(message);
-}
 
 static logging_namespace_t *namespace_find_no_lock(const char *name)
@@ -126,10 +100,8 @@
 	}
 
-	namespace->logfile_level = get_default_logging_level();
+	namespace->level = get_default_logging_level();
 
 	fibril_mutex_initialize(&namespace->guard);
-	fibril_condvar_initialize(&namespace->reader_appeared_cv);
-	prodcons_initialize(&namespace->messages);
-	namespace->has_reader = false;
+	fibril_condvar_initialize(&namespace->level_changed_cv);
 	namespace->writers_count = 0;
 	link_initialize(&namespace->link);
@@ -161,5 +133,5 @@
 
 	fibril_mutex_lock(&namespace->guard);
-	if (namespace->has_reader || (namespace->writers_count > 0)) {
+	if (namespace->writers_count > 0) {
 		fibril_mutex_unlock(&namespace->guard);
 		fibril_mutex_unlock(&namespace_list_guard);
@@ -183,24 +155,4 @@
 }
 
-logging_namespace_t *namespace_reader_attach(const char *name)
-{
-	logging_namespace_t *namespace = NULL;
-
-	fibril_mutex_lock(&namespace_list_guard);
-
-	namespace = namespace_find_no_lock(name);
-
-	if (namespace != NULL) {
-		fibril_mutex_lock(&namespace->guard);
-		namespace->has_reader = true;
-		fibril_condvar_broadcast(&namespace->reader_appeared_cv);
-		fibril_mutex_unlock(&namespace->guard);
-	}
-
-	fibril_mutex_unlock(&namespace_list_guard);
-
-	return namespace;
-}
-
 logging_namespace_t *namespace_writer_attach(const char *name)
 {
@@ -224,14 +176,4 @@
 }
 
-void namespace_reader_detach(logging_namespace_t *namespace)
-{
-	fibril_mutex_lock(&namespace->guard);
-	namespace->has_reader = false;
-	fibril_condvar_broadcast(&namespace->reader_appeared_cv);
-	fibril_mutex_unlock(&namespace->guard);
-
-	namespace_destroy_careful(namespace);
-}
-
 void namespace_writer_detach(logging_namespace_t *namespace)
 {
@@ -247,6 +189,5 @@
 {
 	fibril_mutex_lock(&namespace->guard);
-	bool has_reader = namespace->has_reader
-	    || level <= namespace->logfile_level;
+	bool has_reader = level <= namespace->level;
 	fibril_mutex_unlock(&namespace->guard);
 	return has_reader;
@@ -256,9 +197,9 @@
 {
 	fibril_mutex_lock(&namespace->guard);
-	bool had_reader = namespace->has_reader;
-	while (had_reader == namespace->has_reader) {
-		fibril_condvar_wait(&namespace->reader_appeared_cv, &namespace->guard);
-	}
-	*has_reader_now = namespace->has_reader;
+	log_level_t previous_level = namespace->level;
+	while (previous_level == namespace->level) {
+		fibril_condvar_wait(&namespace->level_changed_cv, &namespace->guard);
+	}
+	*has_reader_now = true;
 	fibril_mutex_unlock(&namespace->guard);
 }
@@ -267,27 +208,10 @@
 void namespace_add_message(logging_namespace_t *namespace, const char *message, log_level_t level)
 {
-	if (level <= get_default_logging_level()) {
+	if (level <= namespace->level) {
 		printf("[%s %d]: %s\n", namespace->name, level, message);
-	}
-	if (level <= namespace->logfile_level) {
 		fprintf(namespace->logfile, "[%d]: %s\n", level, message);
 		fflush(namespace->logfile);
-	}
-
-	fibril_mutex_lock(&namespace->guard);
-	if (namespace->has_reader) {
-		log_message_t *msg = message_create(message, level);
-		if (msg != NULL) {
-			prodcons_produce(&namespace->messages, &msg->link);
-		}
-	}
-	fibril_mutex_unlock(&namespace->guard);
-}
-
-log_message_t *namespace_get_next_message(logging_namespace_t *namespace)
-{
-	link_t *message = prodcons_consume(&namespace->messages);
-
-	return list_get_instance(message, log_message_t, link);
+		fflush(stdout);
+	}
 }
 
