Clean up logging

This commit is contained in:
Alexey Pelykh 2012-03-14 15:03:54 +02:00
parent dd51beff1f
commit 2dc5acfcd7
2 changed files with 9 additions and 16 deletions

View file

@ -17,7 +17,6 @@
#include "multipolygons.h"
#include "proto/osmand_odb.pb.h"
char errorMsg[1024];
#define INT_MAX 0x7fffffff /* max value for an int */
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
using namespace google::protobuf;
@ -347,8 +346,7 @@ bool initMapStructure(io::CodedInputStream* input, BinaryMapFile* file) {
}
}
if (version != versionConfirm) {
__android_log_print(ANDROID_LOG_WARN, "net.osmand",
"Corrupted file. It should be ended as it starts with version");
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Corrupted file. It should be ended as it starts with version");
return false;
}
return true;
@ -746,9 +744,8 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
proccessMultiPolygons(multyPolygons, q.left, q.right, q.bottom, q.top, q.zoom, result->result);
if(q.result.size() > 0) {
sprintf(errorMsg, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees,
q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size());
__android_log_print(ANDROID_LOG_INFO, "net.osmand", errorMsg);
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees,
q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size());
}
delete req;
return (jint)result;
@ -771,8 +768,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLi
FILE* file = fopen(inputName.c_str(), "r");
if (file == NULL) {
sprintf(errorMsg, "File could not be open to read from C : %s", inputName.c_str());
__android_log_print(ANDROID_LOG_WARN, "net.osmand", errorMsg);
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "File could not be open to read from C : %s", inputName.c_str());
return false;
}
BinaryMapFile* mapFile = new BinaryMapFile();
@ -782,8 +778,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLi
io::CodedInputStream cis(&input);
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
if (!initMapStructure(&cis, mapFile)) {
sprintf(errorMsg, "File not initialised : %s", inputName.c_str());
__android_log_print(ANDROID_LOG_WARN, "net.osmand", errorMsg);
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "File not initialised : %s", inputName.c_str());
delete mapFile;
return false;
}

View file

@ -13,7 +13,6 @@
#define INT_MAX 0x7fffffff /* max value for an int */
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
char textMsg[1024] ;
struct tagValueType {
int type;
std::string tag;
@ -118,7 +117,7 @@ MultiPolygonObject* processMultiPolygon(int leftX, int rightX, int bottomY, int
whole.push_back(int_pair(leftX, bottomY));
whole.push_back(int_pair(rightX, bottomY));
completedRings.push_back(whole);
__android_log_print(ANDROID_LOG_INFO, "net.osmand", "!!! Isolated island !!!");
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "!!! Isolated island !!!");
}
}
@ -161,14 +160,13 @@ void proccessMultiPolygons(std::map<tagValueType, std::vector<MapDataObject*> >&
completedRingNames.clear();
incompletedRingNames.clear();
sprintf(textMsg, "Process multipolygon %s %s direct list %d rev %d", val->first.tag.c_str(), val->first.value.c_str(), directList->size(), inverselist->size());
__android_log_print(ANDROID_LOG_INFO, "net.osmand", textMsg);
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Process multipolygon %s %s direct list %d rev %d", val->first.tag.c_str(), val->first.value.c_str(), directList->size(), inverselist->size());
MultiPolygonObject* pl = processMultiPolygon(leftX, rightX, bottomY, topY, completedRings, incompletedRings,
completedRingNames, incompletedRingNames, val->first, *directList, *inverselist, zoom);
if (pl != NULL) {
listPolygons.push_back(pl);
} else {
__android_log_print(ANDROID_LOG_INFO, "net.osmand", "Multipolygon skipped");
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Multipolygon skipped");
}
}
}
@ -361,7 +359,7 @@ void unifyIncompletedRings(std::vector<std::vector<int_pair> >& incompletedRings
// System.err
// .println(MessageFormat.format(dbId + str, dx, dy, dsx, dsy, leftX + "", topY + "", rightX + "", bottomY + "")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
// }
__android_log_print(ANDROID_LOG_INFO, "net.osmand", "Error processing multipolygon");
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Error processing multipolygon");
} else {
nonvisitedRings.insert(j);
}