Commit d4228e21 authored by Julien Michel's avatar Julien Michel

ENH: Make std::cout the default output for library logs

parent f703e27a
......@@ -45,13 +45,12 @@ public:
itkTypeMacro(Logger, itk::Logger);
static Pointer Instance();
itkNewMacro(Self);
// Overwrite this to provide custom formatting of log entries
virtual std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE;
protected:
itkNewMacro(Self);
Logger();
virtual ~Logger() ITK_OVERRIDE;
......
......@@ -21,6 +21,8 @@
#include "otbLogger.h"
#include "itksys/SystemTools.hxx"
#include "otbConfigurationManager.h"
#include "itkStdStreamLogOutput.h"
#include <iostream>
namespace otb
{
......@@ -30,8 +32,16 @@ Logger::Pointer Logger::Singleton = ITK_NULLPTR;
Logger::Pointer Logger::Instance()
{
if(!Logger::Singleton)
{
Logger::Singleton = Logger::New();
// By default, redirect logs to std::cout
itk::StdStreamLogOutput::Pointer defaultOutput = itk::StdStreamLogOutput::New();
defaultOutput->SetStream(std::cout);
Logger::Singleton->AddLogOutput(defaultOutput);
}
return Logger::Singleton;
}
......
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