Commit 28f957d0 authored by Julien Michel's avatar Julien Michel

ENH: Report useful info at logger startup

parent dfac7406
......@@ -50,6 +50,8 @@ public:
// Overwrite this to provide custom formatting of log entries
virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE;
void LogSetupInformation();
protected:
itkNewMacro(Self);
Logger();
......
......@@ -34,8 +34,7 @@ set(OTBCommon_SRC
add_library(OTBCommon ${OTBCommon_SRC})
target_link_libraries(OTBCommon
${OTBITK_LIBRARIES}
${OTBITK_LIBRARIES} ${OTBGDAL_LIBRARIES}
)
otb_module_target(OTBCommon)
......@@ -23,6 +23,8 @@
#include "otbConfigurationManager.h"
#include "itkStdStreamLogOutput.h"
#include <iostream>
#include "gdal.h"
#include "itkMultiThreader.h"
namespace otb
{
......@@ -40,12 +42,14 @@ Logger::Pointer Logger::Instance()
defaultOutput->SetStream(std::cout);
Logger::Singleton->AddLogOutput(defaultOutput);
// Log setup information
Logger::Singleton->LogSetupInformation();
}
return Logger::Singleton;
}
Logger::Logger()
{
this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel());
......@@ -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)
{
static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment