Index: library/bdm/estim/particles.h
===================================================================
--- library/bdm/estim/particles.h (revision 850)
+++ library/bdm/estim/particles.h (revision 870)
@@ -26,9 +26,11 @@
 
 class PF : public BM {
-	//! Introduces two new options:
-	//! \li weights - meaning that all weightes will be logged
-	//! \li samples - all samples will be also logged
+	//! \var log_level_enums weights
+	//! all weightes will be logged
+
+	//! \var log_level_enums samples
+	//! all samples will be logged
 	LOG_LEVEL(PF,weights,samples);
-
+	
 protected:
 	//!number of particles;
@@ -221,7 +223,8 @@
 
 class MPF : public BM  {
-	//! Introduces new option 
-	//! \li means - meaning TODO
+	//! \var log_level_enums means 
+	//! TODO DOPLNIT
 	LOG_LEVEL(MPF,means);
+
 protected:
 	//! particle filter on non-linear variable
Index: library/bdm/bdmroot.h
===================================================================
--- library/bdm/bdmroot.h (revision 865)
+++ library/bdm/bdmroot.h (revision 870)
@@ -38,13 +38,9 @@
 void UI_DBG (const Setting &S, const string &spc, ostream &out );
 	
-//! level of details that will be logged to a logger
-// DULEZITE TODO - zde musi respektovat aktualne ulozene hodnoty, tj. nacist je, pak pridat
-// ty co se maji v tomto kroku ulozit a pak vse ulozit.. protoze to delame kompozici a ne dedenim  DODELAT
-// ALE HOUBY, TAKHLE TO NEJDE, musime nechat jako samostatny objekt, kazda uroven tedy zvlast, 
-// jednoznacne jmeno atd.. 
-//
-//! information about connection to a logger
-template<class T> class logged_options {
+//! This class stores a details that will be logged to a logger
+template<class T> class log_level_template {
 private:
+	// UserInfo class have to be able to read all the internal 
+	// attributes to be able to write/read log_level to/from a Setting structure
 	friend class UI;
 
@@ -52,11 +48,23 @@
 	bitset<32> values;
 
+	//! string equivalents of the used enumerations which are filled with a help of #LOG_LEVEL macro within class T
 	const Array<string> &names() const
 	{
-		return T::option_names();
+		return T::log_level_names();
 	}
 
 public:
 	
+	//! a general utility transforming a comma-separated sequence of strings into an instance of Array<strings>
+	static Array<string> string2Array( const string &input )
+	{
+		string result = input;
+		string::size_type loc;
+		while( loc = result.find( ',' ), loc != string::npos )
+			result[loc] = ' ';
+		return Array<string>("{ " + result + " }" );
+	}
+
+	//! is any field of log_level active?
 	bool any() const
 	{
@@ -64,17 +72,37 @@
 	}
 
-	bool operator [] (const enum T::possible_options &option ) const
-	{
-		return values[option];
-	}
-
-	bitset<32>::reference operator [] (const enum T::possible_options &option )
-	{
-		return values[option];
+	//! read only operator for testing  individual fields of log_level
+	//!
+	//! it is necessary to acces it with a proper enumeration type, thus this approach is type-safe
+	bool operator [] (const enum T::log_level_enums &log_level ) const
+	{
+		return values[log_level];
+	}
+
+	//! operator for setting an individual field of log_level 
+	//!
+	//! it is necessary to acces it with a proper enumeration type, thus this approach is type-safe
+	bitset<32>::reference operator [] (const enum T::log_level_enums &log_level )
+	{
+		return values[log_level];
 	}
 };
 
-// MUZEME INTERNE POUZIVAT ENUMY, A KLIDNE MENIT JEJICH PORADI, DIKY TOMUHLE MAKRU SE VZDY NAMAPUJI NA TY SPRAVNE STRINGY 
-#define LOG_LEVEL(CLASSNAME,...) private: friend class logged_options<CLASSNAME>; static const Array<string> &option_names() { static const Array<string> option_names( "{"#__VA_ARGS__" }" ); return option_names; }; public: enum possible_options { __VA_ARGS__ }; logged_options<CLASSNAME> log_level;
+/*!
+  \def LOG_LEVEL(classname,...)
+  \brief Macro for defining a log_level attribute with a specific set of enumerations related to a specific class 
+
+  This macro has to be called within a class declaration. Its argument \a classname has to correspond to that wrapping class.
+  This macro defines a log_level instance which can be modified either directly or by the means of #UI class.
+
+  One of the main purposes of this macro is to allow variability in using enumerations. By relating them to their names through
+  an array of strings, we are no more dependant on their precise ordering. What is more, we can add or remove any without harming 
+  any applications which are using this library.
+
+  \todo Write a more detailed explanation including also examples
+
+  \ref ui
+*/
+#define LOG_LEVEL(classname,...) public: enum log_level_enums { __VA_ARGS__ }; log_level_template<classname> log_level; private: friend class log_level_template<classname>; static const Array<string> &log_level_names() { static const Array<string> log_level_names = log_level_template<classname>::string2Array( #__VA_ARGS__ ); return log_level_names; }
 
 //forward declaration
@@ -99,9 +127,9 @@
 	friend class UI;
 
-	// TODO okomentovat
-	static const Array<string> &option_names() 
+	//! This method is a dummy method closely related to to the #LOG_LEVEL macro, do not remove it
+	static const string &log_level_names() 
 	{ 
-		static const Array<string> option_names; 
-		return option_names; 
+		static const string log_level_names; 
+		return log_level_names; 
 	}; 
 
@@ -189,6 +217,8 @@
 
 public:
-	// TODO okomentovat
-	enum possible_options { };
+	//! This enumeration defines all possible options specifing the level of details logged by a logger about this specific class 
+	//! 
+	//! It has to be reimplemented in descendant classes using the #LOG_LEVEL macro
+	enum log_level_enums { };
 
 	//!default constructor
Index: library/bdm/base/user_info.h
===================================================================
--- library/bdm/base/user_info.h (revision 863)
+++ library/bdm/base/user_info.h (revision 870)
@@ -305,15 +305,18 @@
 	static void from_setting ( double &real, const Setting &element );
 
-	//! This method converts a Setting into a specific logged_options<T> variant and initialize options properly
-	template< class T> static void from_setting ( logged_options<T> &options, const Setting &element )
+	//! This method converts a Setting into a specific log_level_template<T> variant and initialize options properly
+	template< class T> static void from_setting ( log_level_template<T> &log_level, const Setting &element )
 	{
-		options.values.reset();
-		Array<string> true_options;
-		UI::get( true_options, element );
-		for( int i = 0; i < true_options.length(); i++ )
-			for( int j = 0; j < options.names().length(); j++ ){
-				if( true_options(i) == options.names()(j)  ) 
+		string raw_log_level;
+		UI::get( raw_log_level, element );
+		Array<string> loaded_log_level = log_level_template<T>::string2Array( raw_log_level );
+		
+		log_level.values.reset();
+
+		for( int i = 0; i < loaded_log_level.length(); i++ )
+			for( int j = 0; j < log_level.names().length(); j++ ){
+				if( loaded_log_level(i) == log_level.names()(j)  ) 
 				{
-					options.values[j] = true;
+					log_level.values[j] = true;
 					break;
 				} 
@@ -324,5 +327,5 @@
 	template<class T> static void from_setting ( T* &instance, const Setting &element ) {
 		const SettingResolver link ( element );
-		assert_type ( link.result, Setting::TypeGroup );
+		assert_type( link.result, Setting::TypeGroup );
 
 		// we get a value stored in the "class" attribute
@@ -600,12 +603,14 @@
 	}
 
-	// The only difference from classical UserInfo approach to logged_options is the fact
-	// that the actual element related to logged_options could possibly exists yet. In this case, 
+	// The only difference from classical UserInfo approach to log_level_template is the fact
+	// that the actual UI element related to log_level_template could possibly exists yet. In this case, 
 	// we do not want to throw an exception like in the case of any other type being loaded
-	// from Setting. Here, we rather add our options into this existig element. This way, it is 
-	// possible that more instances of logged_options class (all contained in one wrapping instance of
-	// a particular class!) can be stored in only one line in a configuration file
-	template< class T> static void save ( const logged_options<T> &options, Setting &element, const string &name = "options"  ) {
+	// from Setting. We rather fill the current log_level into this existig element. This way, it is 
+	// possible that more instances of log_level_template class (templated with different classes)
+	// can be stored in only one line in a configuration file
+	template< class T> static void save ( const log_level_template<T> &log_level, Setting &element, const string &name = "log_level"  ) {
 		assert_type ( element, Setting::TypeGroup );
+
+		string string_to_write;
 
 		Setting *list;
@@ -613,16 +618,19 @@
 		{
 			list = &element[name];
-			assert_type ( *list, Setting::TypeList );
+			assert_type ( *list, Setting::TypeString );
+			string_to_write = ( const char* ) *list;
 		}
 		else
-			list = &element.add ( name, Setting::TypeList ); 
-
-		Array<string> true_options;
-		int true_options_count = 0;
-		true_options.set_length( options.values.size() );
-		for( unsigned int i = 0; i < options.values.size(); i++ )
-			if( options.values[i] ) 
-				true_options( true_options_count++ ) = options.names()(i);
-		save( true_options, *list, name );
+			list = &element.add ( name, Setting::TypeString ); 
+
+		for( unsigned int i = 0; i < log_level.values.size(); i++ )
+			if( log_level.values[i] ) // a jeste zkontrolovat zda to jmeno uz neni obsazeno? 
+			{
+				if( string_to_write.length() > 0 )
+					string_to_write = string_to_write + ',';
+				string_to_write = string_to_write + log_level.names()(i);
+			}
+			
+		*list = string_to_write;
 	}
 
Index: library/bdm/base/bdmbase.h
===================================================================
--- library/bdm/base/bdmbase.h (revision 864)
+++ library/bdm/base/bdmbase.h (revision 870)
@@ -492,5 +492,16 @@
 //! Probability density function with numerical statistics, e.g. posterior density.
 class epdf : public pdf {
-	LOG_LEVEL(epdf, logmean, loglb, logub, logfull);
+	//! \var log_level_enums logmean
+	//! TODO DOPLNIT	
+	
+	//! \var log_level_enums loglb
+	//! TODO DOPLNIT
+	
+	//! \var log_level_enums logub
+	//! TODO DOPLNIT
+	
+	//! \var log_level_enums logfull
+	//! TODO DOPLNIT
+	LOG_LEVEL(epdf,logmean,loglb,logub,logfull);
 
 public:
@@ -895,5 +906,8 @@
 
 class DS : public root {
+	//! \var log_level_enums dt
+	//! TODO DOPLNIT
 	LOG_LEVEL(DS, dt);
+
 protected:
 	//! size of data returned by \c getdata()
@@ -983,5 +997,13 @@
 
 class BM : public root {
-	LOG_LEVEL(BM, full, likelihood, bounds);
+	//! \var log_level_enums logfull
+	//! TODO DOPLNIT
+
+	//! \var log_level_enums logevidence
+	//! TODO DOPLNIT
+	
+	//! \var log_level_enums logbounds
+	//! TODO DOPLNIT	
+	LOG_LEVEL(BM,logfull,logevidence,logbounds);
 
 protected:
@@ -1145,14 +1167,13 @@
 	void validate()
 	{
-		if ( log_level[full] ) {
+		if ( log_level[logfull] ) {
 			const_cast<epdf&> ( posterior() ).log_level[epdf::logfull] = true;
 		} else {
-			if ( log_level[bounds] ) {
+			if ( log_level[logbounds] ) {
 				const_cast<epdf&> ( posterior() ).log_level[epdf::loglb] = true;
 			} else {
 				const_cast<epdf&> ( posterior() ).log_level[epdf::logmean] = true;;
 			}
-			if ( log_level[likelihood] ) {
-				// TODO testovat tedy likelyhood misto 1.. log_level = 1;
+			if ( log_level[logevidence] ) {
 			}
 		}
Index: library/bdm/base/bdmbase.cpp
===================================================================
--- library/bdm/base/bdmbase.cpp (revision 863)
+++ library/bdm/base/bdmbase.cpp (revision 870)
@@ -563,9 +563,9 @@
 	}
 	
-	if (log_level[bounds]){
+	if (log_level[logbounds]){
 		prior().log_level[epdf::loglb]=true;
 		prior().log_level[epdf::logub]=true;
 	}
-	if (log_level[full]){
+	if (log_level[logfull]){
 		prior().log_level[epdf::logfull]=true;
 	}
Index: library/bdm/stat/exp_family.h
===================================================================
--- library/bdm/stat/exp_family.h (revision 850)
+++ library/bdm/stat/exp_family.h (revision 870)
@@ -350,5 +350,8 @@
 */
 class egiw : public eEF {
+	//! \var log_level_enums tri
+	//! TODO DOPLNIT
 	LOG_LEVEL(egiw,tri);
+
 protected:
 	//! Extended information matrix of sufficient statistics
