Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [log] remove easylogging++ #29

Merged
merged 2 commits into from
Apr 2, 2024
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
3 changes: 0 additions & 3 deletions 3rdparty/utils/libofd/Color.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <assert.h>
#include "ofd/Color.h"
#include "utils/xml.h"
#include "utils/logger.h"
#include "utils/utils.h"

using namespace ofd;
Expand Down Expand Up @@ -144,7 +143,6 @@ void Color::WriteColorXML(XMLWriter &writer) const{
ss << Value.Values[numChannels - 1];
}

//LOG(DEBUG) << "Color::WriteColorXML() " << ss.str();

writer.WriteAttribute("Value", ss.str());

Expand Down Expand Up @@ -197,7 +195,6 @@ std::tuple<ColorPtr, bool> Color::ReadColorXML(XMLElementPtr colorElement){

std::string valueData;
std::tie(valueData, exist) = colorElement->GetStringAttribute("Value");
//LOG(DEBUG) << "ReadColorXML() valueData=" << valueData;
if ( exist ){
std::vector<std::string> tokens = utils::SplitString(valueData);
if ( tokens.size() == 3 ){
Expand Down
1 change: 0 additions & 1 deletion 3rdparty/utils/libofd/CompositeObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "ofd/Page.h"
#include "ofd/Document.h"

#include "utils/logger.h"
#include "utils/xml.h"

using namespace utils;
Expand Down
27 changes: 13 additions & 14 deletions 3rdparty/utils/libofd/Document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "ofd/Resource.h"
#include "utils/xml.h"
#include "utils/uuid.h"
#include "utils/logger.h"

using namespace ofd;
using namespace utils;
Expand Down Expand Up @@ -53,7 +52,7 @@ bool Document::Open(){
std::string strResXML;
std::tie(strResXML, std::ignore) = m_package.lock()->ReadZipFileString(m_docBody.DocRoot + "/" + m_commonData.PublicRes->GetResDescFile());
if ( !m_commonData.PublicRes->FromResXML(strResXML) ){
LOG(ERROR) << "m_commonData.PublicRes.FromResXML() failed.";
// LOG(ERROR) << "m_commonData.PublicRes.FromResXML() failed.";
return false;
}
}
Expand All @@ -62,7 +61,7 @@ bool Document::Open(){
std::string strResXML;
std::tie(strResXML, std::ignore) = m_package.lock()->ReadZipFileString(m_docBody.DocRoot + "/" + m_commonData.DocumentRes->GetResDescFile());
if ( !m_commonData.DocumentRes->FromResXML(strResXML) ){
LOG(ERROR) << "m_commonData.DocumentRes.FromResXML() failed.";
// LOG(ERROR) << "m_commonData.DocumentRes.FromResXML() failed.";
return false;
} else {
m_commonData.DocumentRes->LoadFonts();
Expand Down Expand Up @@ -359,7 +358,7 @@ bool Document::FromDocBodyXML(XMLElementPtr docBodyElement){
} else if ( childName == "DocRoot" ){
std::string docRoot;
std::tie(docRoot, std::ignore) = childElement->GetStringValue();
LOG(DEBUG) << "DocRoot: " << docRoot;
// LOG(DEBUG) << "DocRoot: " << docRoot;

// TODO
// -------- <Versions>
Expand All @@ -377,7 +376,7 @@ bool Document::FromDocBodyXML(XMLElementPtr docBodyElement){
}

if ( !hasDocInfo ){
LOG(ERROR) << "No DocInfo element in DocBody.";
// LOG(ERROR) << "No DocInfo element in DocBody.";
}

//if ( reader.EnterChildElement("DocBody") ){
Expand All @@ -390,7 +389,7 @@ bool Document::FromDocBodyXML(XMLElementPtr docBodyElement){
//} else if ( reader.CheckElement("DocRoot") ){
//std::string content;
//reader.ReadElement(content);
//LOG(DEBUG) << "DocRoot: " << content;
// LOG(DEBUG) << "DocRoot: " << content;

//// -------- <Versions>
//} else if ( reader.CheckElement("Versions") ){
Expand Down Expand Up @@ -422,13 +421,13 @@ bool Document::fromDocInfoXML(XMLElementPtr docInfoElement){
// Optional.
if ( childName == "DocID" ){
std::tie(docInfo.DocID, std::ignore) = childElement->GetStringValue();
LOG(DEBUG) << "DocID: " << docInfo.DocID;
// LOG(DEBUG) << "DocID: " << docInfo.DocID;

// -------- <Title>
// Optional.
} else if ( childName == "Title" ){
std::tie(docInfo.Title, std::ignore) = childElement->GetStringValue();
LOG(DEBUG) << "Title: " << docInfo.Title;
// LOG(DEBUG) << "Title: " << docInfo.Title;

// -------- <Author>
// Optional.
Expand Down Expand Up @@ -624,10 +623,10 @@ bool Document::FromDocumentXML(const std::string &strDocumentXML){
childElement = childElement->GetNextSiblingElement();
}
} else {
LOG(ERROR) << "Root element in Document Content.xml is not named 'Document'";
// LOG(ERROR) << "Root element in Document Content.xml is not named 'Document'";
}
} else {
LOG(ERROR) << "No root element in Document Content.xml";
// LOG(ERROR) << "No root element in Document Content.xml";
}

return ok;
Expand Down Expand Up @@ -657,7 +656,7 @@ bool Document::fromCommonDataXML(XMLElementPtr commonDataElement){
// OFD (section 7.5) P11. Definitions.xsd
// Required.
std::tie(m_commonData.PageArea, ok) = fromPageAreaXML(childElement);
LOG(DEBUG) << "CommonData.PageArea = " << m_commonData.PageArea.to_string();
// LOG(DEBUG) << "CommonData.PageArea = " << m_commonData.PageArea.to_string();

} else if ( childName == "PublicRes" ){
// -------- <PublicRes>
Expand Down Expand Up @@ -719,18 +718,18 @@ bool Document::fromPagesXML(XMLElementPtr pagesElement){
bool exist = false;
std::tie(pageID, exist) = childElement->GetIntAttribute("ID");
if ( !exist ){
LOG(ERROR) << "Attribute ID is required in Document.xsd";
// LOG(ERROR) << "Attribute ID is required in Document.xsd";
return false;
}

std::string baseLoc;
std::tie(baseLoc, exist) = childElement->GetStringAttribute("BaseLoc");
if ( !exist ){
LOG(ERROR) << "Attribute BaseLoc is required in Document.xsd";
// LOG(ERROR) << "Attribute BaseLoc is required in Document.xsd";
return false;
}

LOG(DEBUG) << "PageID: " << pageID << " BaseLoc: " << baseLoc;
// LOG(DEBUG) << "PageID: " << pageID << " BaseLoc: " << baseLoc;

PagePtr page = AddNewPage();
page->ID = pageID;
Expand Down
1 change: 0 additions & 1 deletion 3rdparty/utils/libofd/Layer.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "ofd/Object.h"
#include "ofd/Layer.h"
#include "ofd/Page.h"
#include "utils/logger.h"

using namespace ofd;
using namespace utils;
Expand Down
9 changes: 4 additions & 5 deletions 3rdparty/utils/libofd/Object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "ofd/Page.h"
#include "ofd/Document.h"
#include "utils/xml.h"
#include "utils/logger.h"
#include "utils/utils.h"

using namespace ofd;
Expand Down Expand Up @@ -223,7 +222,7 @@ bool Object::FromXML(XMLElementPtr objectElement){
if ( ok ){
FromElementsXML(objectElement);
} else {
LOG(WARNING) << "FromAttributesXML() return false;";
// LOG(WARNING) << "FromAttributesXML() return false;";
}

return ok;
Expand All @@ -239,7 +238,7 @@ bool Object::FromAttributesXML(utils::XMLElementPtr objectElement){
bool exist = false;
std::tie(ID, exist) = objectElement->GetIntAttribute("ID");
if ( !exist ){
LOG(ERROR) << "Attribute ID is required in Object XML.";
// LOG(ERROR) << "Attribute ID is required in Object XML.";
return false;
}

Expand All @@ -250,7 +249,7 @@ bool Object::FromAttributesXML(utils::XMLElementPtr objectElement){
//LOG(INFO) << "Boundary: " << strBoundary;

if ( !exist ){
LOG(ERROR) << "Attribute ID is required in Object XML.";
// LOG(ERROR) << "Attribute ID is required in Object XML.";
return false;
}
std::vector<std::string> tokens = utils::SplitString(strBoundary);
Expand All @@ -273,7 +272,7 @@ bool Object::FromAttributesXML(utils::XMLElementPtr objectElement){
Boundary.YMax = top + height;
ok = true;
} else {
LOG(ERROR) << "Box String tokens size >= 4 failed. boxString:" << strBoundary << " element name: " << objectElement->GetName();
// LOG(ERROR) << "Box String tokens size >= 4 failed. boxString:" << strBoundary << " element name: " << objectElement->GetName();
return false;
}

Expand Down
18 changes: 9 additions & 9 deletions 3rdparty/utils/libofd/Package.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "ofd/Resource.h"
#include "utils/xml.h"
#include "utils/zip.h"
#include "utils/logger.h"


using namespace ofd;
using namespace utils;
Expand Down Expand Up @@ -40,7 +40,7 @@ bool Package::Open(const std::string &filename)

m_zip = std::make_shared<utils::Zip>();
if (!m_zip->Open(m_filename, false)) {
LOG(ERROR) << "Error: Open " << m_filename << " failed.";
// LOG(ERROR) << "Error: Open " << m_filename << " failed.";
return false;
}

Expand Down Expand Up @@ -134,11 +134,11 @@ DocumentPtr Package::AddNewDocument()
{
size_t idx = m_documents.size();
std::string docRoot = std::string("Doc_") + std::to_string(idx);
LOG(DEBUG) << "Calling OFDPackage::AddNewDocument(). docRoot: " << docRoot;
// LOG(DEBUG) << "Calling OFDPackage::AddNewDocument(). docRoot: " << docRoot;

DocumentPtr document = Document::CreateNewDocument(GetSelf(), docRoot);

LOG(DEBUG) << "After create document.";
// LOG(DEBUG) << "After create document.";
m_documents.push_back(document);

return document;
Expand Down Expand Up @@ -207,15 +207,15 @@ bool Package::fromOFDXML(const std::string &strOFDXML)
// Required.
std::tie(Version, exist) = rootElement->GetStringAttribute("Version");
if (!exist) {
LOG(ERROR) << "Attribute Version is Required in OFD.xsd";
// LOG(ERROR) << "Attribute Version is Required in OFD.xsd";
return false;
}

// -------- <OFD DocType="">
// Required.
std::tie(DocType, exist) = rootElement->GetStringAttribute("DocType");
if (!exist) {
LOG(ERROR) << "Attribute DocType is Required in OFD.xsd";
// LOG(ERROR) << "Attribute DocType is Required in OFD.xsd";
return false;
}

Expand All @@ -234,7 +234,7 @@ bool Package::fromOFDXML(const std::string &strOFDXML)

std::string docRoot = document->GetDocRoot();
std::string docXMLFile = docRoot + "/Document.xml";
LOG(INFO) << "Document xml:" << docXMLFile;
// LOG(INFO) << "Document xml:" << docXMLFile;

std::string strDocumentXML;
std::tie(strDocumentXML, ok) = ReadZipFileString(docXMLFile);
Expand All @@ -246,10 +246,10 @@ bool Package::fromOFDXML(const std::string &strOFDXML)
if (!hasDocBody) {
}
} else {
LOG(ERROR) << "Root element in OFD.xml is not named 'OFD'";
// LOG(ERROR) << "Root element in OFD.xml is not named 'OFD'";
}
} else {
LOG(ERROR) << "No root element in OFD.xml";
// LOG(ERROR) << "No root element in OFD.xml";
}

return ok;
Expand Down
26 changes: 13 additions & 13 deletions 3rdparty/utils/libofd/Page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "ofd/VideoObject.h"
#include "ofd/CompositeObject.h"
#include "utils/xml.h"
#include "utils/logger.h"


using namespace ofd;
using namespace utils;
Expand Down Expand Up @@ -63,7 +63,7 @@ bool Page::Open()
std::string pageXMLFile = docRoot + "/" + BaseLoc;
if (pageXMLFile.length() >= 4 && pageXMLFile.substr(pageXMLFile.length() - 4) != ".xml")
pageXMLFile.append("/Content.xml");
LOG(INFO) << "Try to open zipfile " << pageXMLFile;
// LOG(INFO) << "Try to open zipfile " << pageXMLFile;

bool ok = false;
std::string strPageXML;
Expand All @@ -72,13 +72,13 @@ bool Page::Open()
m_opened = fromPageXML(strPageXML);

if (m_opened) {
LOG(INFO) << "Open page success.";
LOG(INFO) << to_string();
// LOG(INFO) << "Open page success.";
// LOG(INFO) << to_string();
} else {
LOG(ERROR) << "Open page failed. ID: " << ID << " BaseLoc: " << BaseLoc;
// LOG(ERROR) << "Open page failed. ID: " << ID << " BaseLoc: " << BaseLoc;
}
} else {
LOG(ERROR) << "OFDPage::Open() ReadZipFileString() failed. " << pageXMLFile;
// LOG(ERROR) << "OFDPage::Open() ReadZipFileString() failed. " << pageXMLFile;
}

return m_opened;
Expand Down Expand Up @@ -125,7 +125,7 @@ std::tuple<ST_Box, bool> ReadBoxFromXML(XMLElementPtr boxElement)

std::string boxString;
std::tie(boxString, exist) = boxElement->GetStringValue();
LOG(INFO) << "Box String: " << boxString;
// LOG(INFO) << "Box String: " << boxString;
if (exist) {
std::vector<std::string> tokens = utils::SplitString(boxString);
if (tokens.size() >= 4) {
Expand All @@ -134,7 +134,7 @@ std::tuple<ST_Box, bool> ReadBoxFromXML(XMLElementPtr boxElement)
box.Width = atof(tokens[2].c_str());
box.Height = atof(tokens[3].c_str());
} else {
LOG(ERROR) << "Box String tokens size >= 4 failed. boxString:" << boxString;
// LOG(ERROR) << "Box String tokens size >= 4 failed. boxString:" << boxString;
exist = false;
}
}
Expand Down Expand Up @@ -242,21 +242,21 @@ std::tuple<CT_PageArea, bool> fromPageAreaXML(XMLElementPtr pageAreaElement)
bool ok = true;
CT_PageArea pageArea;

LOG(INFO) << "******** FromPagAreaXML()";
// LOG(INFO) << "******** FromPagAreaXML()";

XMLElementPtr childElement = pageAreaElement->GetFirstChildElement();
while (childElement != nullptr) {

std::string childName = childElement->GetName();
LOG(INFO) << "PageArea child name: " << childName;
// LOG(INFO) << "PageArea child name: " << childName;
bool exist = false;

// -------- <PhysicalBox>
// Required
if (childName == "PhysicalBox") {
std::tie(pageArea.PhysicalBox, exist) = ReadBoxFromXML(childElement);
if (!exist) {
LOG(ERROR) << "Attribute PhysicalBox is requred in PageArea XML";
// LOG(ERROR) << "Attribute PhysicalBox is requred in PageArea XML";
break;
} else {
ok = true;
Expand Down Expand Up @@ -338,7 +338,7 @@ bool Page::fromPageXML(const std::string &strPageXML)
}
}
} else {
LOG(ERROR) << "No root element in Content.xml";
// LOG(ERROR) << "No root element in Content.xml";
}

return ok;
Expand Down Expand Up @@ -422,7 +422,7 @@ bool Page::fromContentXML(XMLElementPtr contentElement)
LayerPtr layer = fromLayerXML(childElement);
if (layer != nullptr) {
m_layers.push_back(layer);
LOG(INFO) << "layer added. GetObjectsCount() = " << layer->GetNumObjects();
// LOG(INFO) << "layer added. GetObjectsCount() = " << layer->GetNumObjects();
ok = true;
}
}
Expand Down
Loading
Loading