Replacing log macros by more sophisticated mechanism

This commit is contained in:
Dennis Luxen
2013-08-08 14:17:01 +02:00
parent a609a1c6c2
commit ef221e1c6c
36 changed files with 242 additions and 446 deletions
+5 -5
View File
@@ -37,9 +37,9 @@ void BaseParser::ReadUseRestrictionsSetting() {
use_turn_restrictions = lua_toboolean(luaState, -1);
}
if( use_turn_restrictions ) {
INFO("Using turn restrictions" );
SimpleLogger().Write() << "Using turn restrictions";
} else {
INFO("Ignoring turn restrictions" );
SimpleLogger().Write() << "Ignoring turn restrictions";
}
}
@@ -51,12 +51,12 @@ void BaseParser::ReadRestrictionExceptions() {
"get_exceptions",
boost::ref(restriction_exceptions)
);
INFO("Found " << restriction_exceptions.size() << " exceptions to turn restriction");
SimpleLogger().Write() << "Found " << restriction_exceptions.size() << " exceptions to turn restriction";
BOOST_FOREACH(const std::string & str, restriction_exceptions) {
INFO(" " << str);
SimpleLogger().Write() << " " << str;
}
} else {
INFO("Found no exceptions to turn restrictions");
SimpleLogger().Write() << "Found no exceptions to turn restrictions";
}
}
+1
View File
@@ -24,6 +24,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "ExtractorCallbacks.h"
#include "ScriptingEnvironment.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
extern "C" {
#include <lua.h>
+2 -2
View File
@@ -117,7 +117,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
++restrictionsIT;
}
std::cout << "ok, after " << get_timestamp() - time << "s" << std::endl;
INFO("usable restrictions: " << usableRestrictionsCounter );
SimpleLogger().Write() << "usable restrictions: " << usableRestrictionsCounter;
//serialize restrictions
std::ofstream restrictionsOutstream;
restrictionsOutstream.open(restrictionsFileName.c_str(), std::ios::binary);
@@ -298,7 +298,7 @@ void ExtractionContainers::PrepareData(const std::string & output_file_name, con
// addressOutFile.close();
// cout << "ok, after " << get_timestamp() - time << "s" << endl;
INFO("Processed " << usedNodeCounter << " nodes and " << usedEdgeCounter << " edges");
SimpleLogger().Write() << "Processed " << usedNodeCounter << " nodes and " << usedEdgeCounter << " edges";
} catch ( const std::exception& e ) {
+1
View File
@@ -22,6 +22,7 @@
#define EXTRACTIONCONTAINERS_H_
#include "ExtractorStructs.h"
#include "../Util/SimpleLogger.h"
#include "../Util/TimingUtil.h"
#include "../Util/UUID.h"
+5 -2
View File
@@ -45,7 +45,9 @@ bool ExtractorCallbacks::restrictionFunction(const _RawRestrictionContainer &r)
void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
if((0 < parsed_way.speed) || (0 < parsed_way.duration)) { //Only true if the way is specified by the speed profile
if(UINT_MAX == parsed_way.id){
DEBUG("found bogus way with id: " << parsed_way.id << " of size " << parsed_way.path.size());
SimpleLogger().Write(logDEBUG) <<
"found bogus way with id: " << parsed_way.id <<
" of size " << parsed_way.path.size();
return;
}
@@ -55,7 +57,8 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
}
if(FLT_EPSILON >= fabs(-1. - parsed_way.speed)){
DEBUG("found way with bogus speed, id: " << parsed_way.id);
SimpleLogger().Write(logDEBUG) <<
"found way with bogus speed, id: " << parsed_way.id;
return;
}
+5 -4
View File
@@ -49,9 +49,10 @@ PBFParser::~PBFParser() {
}
google::protobuf::ShutdownProtobufLibrary();
#ifndef NDEBUG
DEBUG("parsed " << blockCount << " blocks from pbf with " << groupCount << " groups");
#endif
SimpleLogger().Write(logDEBUG) <<
"parsed " << blockCount <<
" blocks from pbf with " << groupCount <<
" groups";
}
inline bool PBFParser::ReadHeader() {
@@ -108,7 +109,7 @@ inline void PBFParser::ParseData() {
_ThreadData *threadData;
threadDataQueue->wait_and_pop(threadData);
if( NULL==threadData ) {
INFO("Parse Data Thread Finished");
SimpleLogger().Write() << "Parse Data Thread Finished";
threadDataQueue->push(NULL); // Signal end of data for other threads
break;
}
+1
View File
@@ -29,6 +29,7 @@
#include "../Util/MachineInfo.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <boost/shared_ptr.hpp>
+1 -1
View File
@@ -22,7 +22,7 @@
ScriptingEnvironment::ScriptingEnvironment() {}
ScriptingEnvironment::ScriptingEnvironment(const char * fileName) {
INFO("Using script " << fileName);
SimpleLogger().Write() << "Using script " << fileName;
// Create a new lua state
for(int i = 0; i < omp_get_max_threads(); ++i) {
+1
View File
@@ -27,6 +27,7 @@
#include "../Util/LuaUtil.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/OSRMException.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"
#include <vector>
+3 -1
View File
@@ -27,7 +27,9 @@
#include <boost/ref.hpp>
XMLParser::XMLParser(const char * filename, ExtractorCallbacks* ec, ScriptingEnvironment& se) : BaseParser(ec, se) {
WARN("Parsing plain .osm/.osm.bz2 is deprecated. Switch to .pbf");
SimpleLogger().Write(logWARNING) <<
"Parsing plain .osm/.osm.bz2 is deprecated. Switch to .pbf";
inputReader = inputReaderFactory(filename);
}
+1
View File
@@ -23,6 +23,7 @@
#include "BaseParser.h"
#include "../DataStructures/Coordinate.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
#include "../typedefs.h"