Commit 3c023d6e authored by Julien Michel's avatar Julien Michel

ENH: Adressing minor comments from @lnicola

parent f88b77c1
......@@ -93,7 +93,7 @@ public:
* INFO, WARNING, CRITICAL or FATAL, the logger level will be
* set accordingly.
*
* Priority is DEBUG < INFO < WARNING < CRITICAL < FATAL.
* Priority is DEBUG < INFO < WARNING < CRITICAL < FATAL.
*
* Only messages with a higher priority than the logger level will
* be displayed.
......
......@@ -49,7 +49,7 @@ public:
itkNewMacro(Self);
// Overwrite this to provide custom formatting of log entries
virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE;
std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE;
void LogSetupInformation();
......
......@@ -50,6 +50,7 @@ namespace otb
#define otbClassContext(x) \
<< this->GetNameOfClass() << " (" << this << "): " x
// Beware that to log to CRITICAL level, level should be passed as "Error"
#define otbLogMacro(level,msg) \
{ \
std::ostringstream itkmsg; \
......@@ -58,21 +59,14 @@ namespace otb
}
// Re-definition of old log macros to use the otbLogMacro
#define otbDebugMacro(x) otbLogMacro(Debug,otbFileContext(otbClassContext(x)))
#define otbMsgDebugMacro(x) otbLogMacro(Debug,otbFileContext(x))
#define otbGenericMsgDebugMacro(x) otbLogMacro(Debug,x)
#define otbMsgDevMacro(x) otbLogMacro(Debug,otbFileContext(x))
#define otbWarningMacro(x) otbLogMacro(Warning,otbFileContext(otbClassContext(x)))
#define otbGenericWarningMacro(x) otbLogMacro(Warning,otbFileContext(x))
// TODO: Address this macro as well
#define otbGenericMsgTestingMacro(x) \
{ \
std::cout x << std::endl; \
}
#define otbGenericMsgTestingMAcro(x) otbLogMacro(Info,"[testing] "<<x)
/** This macro is used to control condition. It use ONLY by the OTB developers
*
......
......@@ -20,6 +20,8 @@
#include "otbConfigurationManager.h"
#include "otbMacro.h"
#include "itksys/SystemTools.hxx"
#include <cstdlib>
......@@ -85,11 +87,26 @@ itk::LoggerBase::PriorityLevelType ConfigurationManager::GetLoggerLevel()
if(itksys::SystemTools::GetEnv("OTB_LOGGER_LEVEL",svalue))
{
level_macro(DEBUG);
level_macro(WARNING);
level_macro(INFO);
level_macro(CRITICAL);
level_macro(FATAL);
if(svalue.compare("DEBUG") == 0)
{
level = itk::LoggerBase::DEBUG;
}
else if(svalue.compare("INFO") == 0)
{
level = itk::LoggerBase::INFO;
}
else if(svalue.compare("WARNING") == 0)
{
level = itk::LoggerBase::WARNING;
}
else if(svalue.compare("CRITICAL") == 0)
{
level = itk::LoggerBase::CRITICAL;
}
else
{
otbLogMacro(Error,<<"Unknown value for OTB_LOGGER_LEVEL_MACRO. Possible values are DEBUG, INFO, WARNING, CRITICAL.");
}
}
return level;
}
......
......@@ -71,14 +71,17 @@ void Logger::LogSetupInformation()
oss<<"Default RAM limit for OTB is "<<otb::ConfigurationManager::GetMaxRAMHint()<<" MB"<<std::endl;
this->Info(oss.str());
oss.str("");
oss.clear();
oss<<"Gdal maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" MB"<<std::endl;
oss<<"GDAL maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" MB"<<std::endl;
this->Info(oss.str());
oss.str("");
oss.clear();
oss<<"OTB will use at most "<<itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<" threads"<<std::endl;
this->Info(oss.str());
oss.str("");
oss.clear();
}
std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content)
......
......@@ -860,7 +860,7 @@ void GDALImageIO::InternalReadImageInformation()
}
else
{
otbLogMacro(Warning,<< "Geotransform reported by Gdal is invalid (spacing = 0)");
otbLogMacro(Warning,<< "Geotransform reported by GDAL is invalid (spacing = 0)");
m_Spacing[0] = 1;
m_Spacing[1] = 1;
}
......
......@@ -513,7 +513,7 @@ ImageFileWriter<TInputImage>
/** Control if the ImageIO is CanStreamWrite */
if (m_ImageIO->CanStreamWrite() == false)
{
otbLogMacro(Warning,<<"The file format of " << m_FileName.c_str() <<
otbLogMacro(Warning,<<"The file format of " << m_FileName <<
" does not support streaming. All data will be loaded to memory");
this->SetNumberOfDivisionsStrippedStreaming(1);
}
......
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