198 | | //! This is only the first part of the whole declaration, which has to be however separated into |
199 | | //! two different classes for allowing the compilation of source code. For more details |
200 | | //! see logger::add_setting(...) method and mainly log_level_template<T>::template<class U> void store( const enum T::log_level_enums log_level_enum, const U data ) const |
201 | | //! method. For the reason the second one is templated, it was necessary to declare this whole class. |
202 | | template<class T> class log_level_base : public root { |
| 198 | //! the existence of this class is forced by the necessity of passing log_levels to user_info methods, however, the main functionality |
| 199 | //! is located in \c log_level_template class |
| 200 | class log_level_base : public root { |
206 | | |
207 | | |
208 | | //! this method adds new id to its proper position and return the name of this position |
209 | | string store_id_and_give_name( enum T::log_level_enums const log_level_enum, int enum_subindex, int id ) { |
210 | | if( ids(log_level_enum).length() <= enum_subindex ) |
211 | | ids(log_level_enum).set_size( enum_subindex+1, true ); |
212 | | ids(log_level_enum)(enum_subindex) = id; |
213 | | |
214 | | // here we remove a "log" prefix from name, i.e., for instance it transforms "logevidence" to "evidence" |
215 | | ostringstream stream; |
216 | | string name_with_prefix = names()(log_level_enum); |
217 | | string possible_log_prefix = name_with_prefix.substr(0,3); |
218 | | if( possible_log_prefix == "log" ) |
219 | | stream << name_with_prefix.substr(3,name_with_prefix.length()-3); |
220 | | else |
221 | | stream << name_with_prefix; |
222 | | |
223 | | // add number to name only in the case there are more registered vectors with the same log_level_enum |
224 | | if( ids(log_level_enum).length() > 1 ) |
225 | | stream << "_" << enum_subindex; |
226 | | |
227 | | return stream.str(); |
228 | | } |