Skip to content
Snippets Groups Projects
Commit 28f957d0 authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Report useful info at logger startup

parent dfac7406
Branches
Tags
No related merge requests found
...@@ -50,6 +50,8 @@ public: ...@@ -50,6 +50,8 @@ public:
// Overwrite this to provide custom formatting of log entries // Overwrite this to provide custom formatting of log entries
virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE; virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE;
void LogSetupInformation();
protected: protected:
itkNewMacro(Self); itkNewMacro(Self);
Logger(); Logger();
......
...@@ -34,8 +34,7 @@ set(OTBCommon_SRC ...@@ -34,8 +34,7 @@ set(OTBCommon_SRC
add_library(OTBCommon ${OTBCommon_SRC}) add_library(OTBCommon ${OTBCommon_SRC})
target_link_libraries(OTBCommon target_link_libraries(OTBCommon
${OTBITK_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBGDAL_LIBRARIES}
) )
otb_module_target(OTBCommon) otb_module_target(OTBCommon)
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "otbConfigurationManager.h" #include "otbConfigurationManager.h"
#include "itkStdStreamLogOutput.h" #include "itkStdStreamLogOutput.h"
#include <iostream> #include <iostream>
#include "gdal.h"
#include "itkMultiThreader.h"
namespace otb namespace otb
{ {
...@@ -40,12 +42,14 @@ Logger::Pointer Logger::Instance() ...@@ -40,12 +42,14 @@ Logger::Pointer Logger::Instance()
defaultOutput->SetStream(std::cout); defaultOutput->SetStream(std::cout);
Logger::Singleton->AddLogOutput(defaultOutput); Logger::Singleton->AddLogOutput(defaultOutput);
// Log setup information
Logger::Singleton->LogSetupInformation();
} }
return Logger::Singleton; return Logger::Singleton;
} }
Logger::Logger() Logger::Logger()
{ {
this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel()); this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel());
...@@ -60,6 +64,23 @@ Logger::~Logger() ...@@ -60,6 +64,23 @@ Logger::~Logger()
{ {
} }
void Logger::LogSetupInformation()
{
std::ostringstream oss;
oss<<"Default RAM limit for OTB is "<<otb::ConfigurationManager::GetMaxRAMHint()<<" Mb"<<std::endl;
this->Info(oss.str());
oss.str("");
oss<<"Gdal maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" Mb"<<std::endl;
this->Info(oss.str());
oss.str("");
oss<<"OTB will use at most "<<itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<" threads"<<std::endl;
this->Info(oss.str());
oss.str("");
}
std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content) std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content)
{ {
static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)", static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment