- Timestamp:
- 11/29/15 22:19:52 (9 years ago)
- Location:
- cpp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/loggers/loggers.cpp
r378 r452 123 123 } 124 124 } 125 126 string LoggerToMemory::getCountSummary() const 127 { 128 if (getInfoCount()) 129 { 130 string msg; 131 if (getErrorCount()) 132 msg=ssprintf("%d error(s)",getErrorCount()); 133 int w; 134 if (w=getWarningCount()-getErrorCount()) 135 msg+=ssprintf("%s%d warning(s)",(getErrorCount()?", ":""),w); 136 if (w=getInfoCount()-getWarningCount()) 137 msg+=ssprintf("%s%d message(s)",(getWarningCount()?", ":""),w); 138 return msg; 139 } 140 return string(""); 141 } 142 -
cpp/common/loggers/loggers.h
r378 r452 91 91 }; 92 92 93 int getErrorCount() { return errcount; } 94 int getWarningCount() { return warncount; } 95 int getInfoCount() { return infocount; } 96 int getStoredCount() { return storedcount; } 97 int getErrorLevel() { return maxlevel; } 98 const string getMessages() { return msgs; } 93 int getErrorCount() const { return errcount; } 94 int getWarningCount() const { return warncount; } 95 int getInfoCount() const { return infocount; } 96 int getStoredCount() const { return storedcount; } 97 int getErrorLevel() const { return maxlevel; } 98 string getMessages() const { return msgs; } 99 string getCountSummary() const; ///< return the standard "... error(s), ... warning(s), ... message(s)" text (or empty string if count==0) 99 100 100 101 LoggerToMemory(int opts = 0, int minimal_level_to_store = LOG_ERROR) :LoggerBase(opts), minleveltostore(minimal_level_to_store) -
cpp/frams/genetics/geno.cpp
r375 r452 5 5 #include "geno.h" 6 6 #include "genoconv.h" 7 #include <common/loggers/loggers.h> 8 #include <common/stl-util.h> 7 9 #include <frams/model/model.h> 8 10 … … 255 257 bool Geno::isValid(void) 256 258 { 257 if (isvalid<0) validate(); 259 if (isvalid<0) 260 { 261 LoggerToMemory err(LoggerBase::Enable | LoggerToMemory::StoreAllMessages,LOG_INFO); 262 validate(); 263 err.disable(); 264 string msg=err.getCountSummary(); 265 if (msg.size()>0) 266 { 267 msg+=ssprintf(" while checking validity of '%s'",getName().c_str()); 268 msg+="\n"; 269 msg+=err.getMessages(); 270 logMessage("Geno","isValid",err.getErrorLevel(),msg.c_str()); 271 } 272 } 258 273 return isvalid>0; 259 274 }
Note: See TracChangeset
for help on using the changeset viewer.