Replacing log macros by more sophisticated mechanism
This commit is contained in:
@@ -20,7 +20,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
|
||||
#include "QueryObjectsStorage.h"
|
||||
#include "../../Util/GraphLoader.h"
|
||||
|
||||
QueryObjectsStorage::QueryObjectsStorage(
|
||||
const std::string & hsgrPath,
|
||||
@@ -31,7 +30,7 @@ QueryObjectsStorage::QueryObjectsStorage(
|
||||
const std::string & namesPath,
|
||||
const std::string & timestampPath
|
||||
) {
|
||||
INFO("loading graph data");
|
||||
SimpleLogger().Write() << "loading graph data";
|
||||
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
|
||||
if(!hsgrInStream) {
|
||||
throw OSRMException("hsgr not found");
|
||||
@@ -47,15 +46,17 @@ QueryObjectsStorage::QueryObjectsStorage(
|
||||
);
|
||||
hsgrInStream.close();
|
||||
|
||||
INFO("Data checksum is " << checkSum);
|
||||
SimpleLogger().Write() << "Data checksum is " << checkSum;
|
||||
graph = new QueryGraph(nodeList, edgeList);
|
||||
assert(0 == nodeList.size());
|
||||
assert(0 == edgeList.size());
|
||||
|
||||
if(timestampPath.length()) {
|
||||
INFO("Loading Timestamp");
|
||||
SimpleLogger().Write() << "Loading Timestamp";
|
||||
std::ifstream timestampInStream(timestampPath.c_str());
|
||||
if(!timestampInStream) { WARN(timestampPath << " not found"); }
|
||||
if(!timestampInStream) {
|
||||
SimpleLogger().Write(logWARNING) << timestampPath << " not found";
|
||||
}
|
||||
|
||||
getline(timestampInStream, timestamp);
|
||||
timestampInStream.close();
|
||||
@@ -67,7 +68,7 @@ QueryObjectsStorage::QueryObjectsStorage(
|
||||
timestamp.resize(25);
|
||||
}
|
||||
|
||||
INFO("Loading auxiliary information");
|
||||
SimpleLogger().Write() << "Loading auxiliary information";
|
||||
//Init nearest neighbor data structure
|
||||
nodeHelpDesk = new NodeInformationHelpDesk(
|
||||
ramIndexPath,
|
||||
@@ -79,7 +80,7 @@ QueryObjectsStorage::QueryObjectsStorage(
|
||||
);
|
||||
|
||||
//deserialize street name list
|
||||
INFO("Loading names index");
|
||||
SimpleLogger().Write() << "Loading names index";
|
||||
std::ifstream namesInStream(namesPath.c_str(), std::ios::binary);
|
||||
if(!namesInStream) {
|
||||
throw OSRMException("names file not found");
|
||||
@@ -97,7 +98,7 @@ QueryObjectsStorage::QueryObjectsStorage(
|
||||
}
|
||||
std::vector<std::string>(names).swap(names);
|
||||
namesInStream.close();
|
||||
INFO("All query data structures loaded");
|
||||
SimpleLogger().Write() << "All query data structures loaded";
|
||||
}
|
||||
|
||||
QueryObjectsStorage::~QueryObjectsStorage() {
|
||||
|
||||
@@ -24,8 +24,9 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
#include<vector>
|
||||
#include<string>
|
||||
|
||||
#include "../../Util/GraphLoader.h"
|
||||
#include "../../Util/OSRMException.h"
|
||||
#include "../../Util/SimpleLogger.h"
|
||||
#include "../../DataStructures/NodeInformationHelpDesk.h"
|
||||
#include "../../DataStructures/QueryEdge.h"
|
||||
#include "../../DataStructures/StaticGraph.h"
|
||||
|
||||
@@ -25,6 +25,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "BasicDatastructures.h"
|
||||
#include "../Library/OSRM.h"
|
||||
#include "../Plugins/RouteParameters.h"
|
||||
#include "../Util/SimpleLogger.h"
|
||||
#include "../Util/StringUtil.h"
|
||||
#include "../typedefs.h"
|
||||
|
||||
@@ -53,8 +54,8 @@ public:
|
||||
ltime=time(NULL);
|
||||
Tm=localtime(<ime);
|
||||
|
||||
INFO((Tm->tm_mday < 10 ? "0" : "" ) << Tm->tm_mday << "-" << (Tm->tm_mon+1 < 10 ? "0" : "" ) << (Tm->tm_mon+1) << "-" << 1900+Tm->tm_year << " " << (Tm->tm_hour < 10 ? "0" : "" ) << Tm->tm_hour << ":" << (Tm->tm_min < 10 ? "0" : "" ) << Tm->tm_min << ":" << (Tm->tm_sec < 10 ? "0" : "" ) << Tm->tm_sec << " " <<
|
||||
req.endpoint.to_string() << " " << req.referrer << ( 0 == req.referrer.length() ? "- " :" ") << req.agent << ( 0 == req.agent.length() ? "- " :" ") << req.uri );
|
||||
SimpleLogger().Write() << (Tm->tm_mday < 10 ? "0" : "" ) << Tm->tm_mday << "-" << (Tm->tm_mon+1 < 10 ? "0" : "" ) << (Tm->tm_mon+1) << "-" << 1900+Tm->tm_year << " " << (Tm->tm_hour < 10 ? "0" : "" ) << Tm->tm_hour << ":" << (Tm->tm_min < 10 ? "0" : "" ) << Tm->tm_min << ":" << (Tm->tm_sec < 10 ? "0" : "" ) << Tm->tm_sec << " " <<
|
||||
req.endpoint.to_string() << " " << req.referrer << ( 0 == req.referrer.length() ? "- " :" ") << req.agent << ( 0 == req.agent.length() ? "- " :" ") << req.uri;
|
||||
}
|
||||
|
||||
RouteParameters routeParameters;
|
||||
@@ -84,7 +85,8 @@ public:
|
||||
}
|
||||
} catch(std::exception& e) {
|
||||
rep = http::Reply::stockReply(http::Reply::internalServerError);
|
||||
WARN("[server error] code: " << e.what() << ", uri: " << req.uri);
|
||||
SimpleLogger().Write(logWARNING) <<
|
||||
"[server error] code: " << e.what() << ", uri: " << req.uri;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user