[xiph-commits] r16645 - trunk/oggdsf/src/lib/helper/common

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Tue Oct 13 14:56:31 PDT 2009


Author: cristianadam
Date: 2009-10-13 14:56:31 -0700 (Tue, 13 Oct 2009)
New Revision: 16645

Modified:
   trunk/oggdsf/src/lib/helper/common/Log.h
   trunk/oggdsf/src/lib/helper/common/util.h
Log:
Used log levels as strings instead of numbers in the configuration xml file.

Modified: trunk/oggdsf/src/lib/helper/common/Log.h
===================================================================
--- trunk/oggdsf/src/lib/helper/common/Log.h	2009-10-13 21:54:34 UTC (rev 16644)
+++ trunk/oggdsf/src/lib/helper/common/Log.h	2009-10-13 21:56:31 UTC (rev 16645)
@@ -138,6 +138,7 @@
 
     if (logLevels.empty())
     {
+        logLevels[L"NONE"]    = logNONE;
         logLevels[L"ERROR"]   = logERROR;
         logLevels[L"WARNING"] = logWARNING;
         logLevels[L"INFO"]    = logINFO;
@@ -151,7 +152,7 @@
     LogLevelNamesMap::iterator it = logLevels.find(level);
     if (it == logLevels.end())
     {
-        Log<T>().Get(logWARNING) << L"Unknown logging level '" << level
+        LogT<T>().Get(logWARNING) << L"Unknown logging level '" << level
             << L"'. Using INFO level as default.";
 
         return logINFO;

Modified: trunk/oggdsf/src/lib/helper/common/util.h
===================================================================
--- trunk/oggdsf/src/lib/helper/common/util.h	2009-10-13 21:54:34 UTC (rev 16644)
+++ trunk/oggdsf/src/lib/helper/common/util.h	2009-10-13 21:56:31 UTC (rev 16645)
@@ -47,21 +47,11 @@
 
         xpath_query query(queryString.str().c_str());
 
-        string levelString = doc.select_single_node(query).node().attribute("Level").value();
+        wstring levelString = CA2W(doc.select_single_node(query).node().attribute("Level").value());
+        Log::ReportingLevel() = Log::FromString(levelString);
 
-        unsigned short level = logNONE;
-        if (!levelString.empty())
+        if (Log::ReportingLevel() != logNONE)
         {
-            istringstream is;
-            is.str(levelString);
-
-            is >> level;
-        }
-
-        Log::ReportingLevel() = static_cast<LogLevel>(level);
-
-        if (level != logNONE)
-        {
             wstring logFileName = configLocation;
             logFileName += L"\\";
             logFileName += moduleName + L".log";



More information about the commits mailing list