diff --git a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index b5741ee4c6a1e9dbecbb1ee969bc1c972b967793..2f0ababa07fbdb3443fd3669da412e49c9b6bff6 100644 --- a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h +++ b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h @@ -45,6 +45,7 @@ public: bool initDB(); + /// level --> 0: silenced/production - 1: info - 2: verbose - 3: debug void setLogLevel(const unsigned int level) {m_logLevel = level;} int loadGeoNodeTypesAndBuildCache(); diff --git a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp index c4d8614633f7730e8a3d901750f79c0cf4e8e165..6d236871058fcb0cf3275f20d425a358ef07b12b 100644 --- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp @@ -96,7 +96,7 @@ GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbIsOK(fal } // set default logLevel - m_logLevel = 0; + m_logLevel = 1; // 0: silenced/production - 1: info - 2: verbose - 3: debug m_dbIsOK = false; @@ -106,10 +106,11 @@ GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbIsOK(fal // Test if there was an error if (exit == SQLITE_OK) { - std::cout << "The Geometry Database '"<< path << "' has been opened successfully!" << std::endl; + if ( m_logLevel >= 1 ) + std::cout << "The Geometry Database '"<< path << "' has been opened successfully!" << std::endl; m_dbIsOK = true; } else { - std::cout << "DB Open Error: " << sqlite3_errmsg(m_d->m_dbSqlite) << std::endl; + std::cerr << "DB Open Error: " << sqlite3_errmsg(m_d->m_dbSqlite) << std::endl; m_dbIsOK = false; } @@ -420,7 +421,7 @@ bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std if(m_debug) std::cout << "tableColString:" << tableColString << std::endl; unsigned int nRecords = records.size(); - if (m_logLevel > 0) { + if (m_logLevel >= 2) { std::cout << "Info: number of " << tableName << " records to dump into the DB:" << nRecords << std::endl; } // preparing the SQL query @@ -458,7 +459,7 @@ bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std if(m_debug) std::cout << "tableColString:" << tableColString << std::endl; unsigned int nRecords = records.size(); - if (m_logLevel > 0) { + if (m_logLevel >= 2) { std::cout << "Info: number of " << tableName << " records to dump into the DB:" << nRecords << std::endl; }