Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Add log4cplus version awareness, fix #116 #117

Merged
merged 2 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions xhalcore/src/common/XHALInterface.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#include "xhal/XHALInterface.h"

#include <log4cplus/version.h>

int xhal::XHALInterface::index = 0;

xhal::XHALInterface::XHALInterface(const std::string& board_domain_name):
m_board_domain_name(board_domain_name),
isConnected(false)
{
log4cplus::SharedAppenderPtr myAppender(new log4cplus::ConsoleAppender());
std::auto_ptr<log4cplus::Layout> myLayout = std::auto_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout());
myAppender->setLayout( myLayout );
#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
myAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout()));
#else
myAppender->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout()));
#endif
// Following strange construction is required because it looks like log4cplus was compiled withot c++11 support...
auto t_logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("XHALInterface_"+m_board_domain_name + "_" + std::to_string(index)));
++index;
Expand Down
9 changes: 7 additions & 2 deletions xhalcore/src/common/utils/XHALXMLParser.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#include "xhal/utils/XHALXMLParser.h"

#include <log4cplus/version.h>

int xhal::utils::XHALXMLParser::index = 0;

xhal::utils::XHALXMLParser::XHALXMLParser(const std::string& xmlFile)
{
m_xmlFile = xmlFile;
log4cplus::SharedAppenderPtr myAppender(new log4cplus::ConsoleAppender());
std::auto_ptr<log4cplus::Layout> myLayout = std::auto_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout());
myAppender->setLayout( myLayout );
#if LOG4CPLUS_VERSION < LOG4CPLUS_MAKE_VERSION(2, 0, 0)
myAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout()));
#else
myAppender->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::TTCCLayout()));
#endif
auto t_logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("XHALXMLParser_" + std::to_string(index)));
++index;
m_logger = t_logger;
Expand Down