Other LogAux functions

pull/3905/head
Malcolm Tyrrell 2021-05-13 10:43:28 +01:00
parent c5f22269a8
commit ad6f300b1d
4 changed files with 39 additions and 66 deletions

View File

@ -235,9 +235,9 @@ void BlenderImporter::InternReadFile(const std::string &pFile,
stream->Read(magic, 3, 1);
magic[3] = '\0';
LogInfo((format(), "Blender version is ", magic[0], ".", magic + 1,
LogInfo("Blender version is ", magic[0], ".", magic + 1,
" (64bit: ", file.i64bit ? "true" : "false",
", little endian: ", file.little ? "true" : "false", ")"));
", little endian: ", file.little ? "true" : "false", ")");
ParseBlendFile(file, stream);
@ -434,7 +434,7 @@ void BlenderImporter::ResolveImage(aiMaterial *out, const Material *mat, const M
curTex->pcData = reinterpret_cast<aiTexel *>(ch);
LogInfo("Reading embedded texture, original file was " + std::string(img->name));
LogInfo("Reading embedded texture, original file was ", img->name);
} else {
name = aiString(img->name);
}

View File

@ -307,8 +307,8 @@ void MeshGeometry::ReadLayerElement(const Scope& layerElement)
}
}
FBXImporter::LogError(Formatter::format("failed to resolve vertex layer element: ")
<< type << ", index: " << typedIndex);
FBXImporter::LogError("failed to resolve vertex layer element: ",
type, ", index: ", typedIndex);
}
// ------------------------------------------------------------------------------------------------
@ -324,8 +324,8 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
if (type == "LayerElementUV") {
if(index >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
FBXImporter::LogError(Formatter::format("ignoring UV layer, maximum number of UV channels exceeded: ")
<< index << " (limit is " << AI_MAX_NUMBER_OF_TEXTURECOORDS << ")" );
FBXImporter::LogError("ignoring UV layer, maximum number of UV channels exceeded: ",
index, " (limit is ", AI_MAX_NUMBER_OF_TEXTURECOORDS, ")" );
return;
}
@ -402,8 +402,8 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
}
else if (type == "LayerElementColor") {
if(index >= AI_MAX_NUMBER_OF_COLOR_SETS) {
FBXImporter::LogError(Formatter::format("ignoring vertex color layer, maximum number of color sets exceeded: ")
<< index << " (limit is " << AI_MAX_NUMBER_OF_COLOR_SETS << ")" );
FBXImporter::LogError("ignoring vertex color layer, maximum number of color sets exceeded: ",
index, " (limit is ", AI_MAX_NUMBER_OF_COLOR_SETS, ")" );
return;
}
@ -449,8 +449,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
if (tempData.size() != mapping_offsets.size()) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
<< tempData.size() << ", expected " << mapping_offsets.size());
FBXImporter::LogError("length of input data unexpected for ByVertice mapping: ",
tempData.size(), ", expected ", mapping_offsets.size());
return;
}
@ -470,8 +470,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
if (uvIndices.size() != vertex_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByVertice mapping: ")
<< uvIndices.size() << ", expected " << vertex_count);
FBXImporter::LogError("length of input data unexpected for ByVertice mapping: ",
uvIndices.size(), ", expected ", vertex_count);
return;
}
@ -493,8 +493,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
if (tempData.size() != vertex_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")
<< tempData.size() << ", expected " << vertex_count
FBXImporter::LogError("length of input data unexpected for ByPolygon mapping: ",
tempData.size(), ", expected ", vertex_count
);
return;
}
@ -515,8 +515,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
}
if (uvIndices.size() != vertex_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
<< uvIndices.size() << ", expected " << vertex_count);
FBXImporter::LogError("length of input data unexpected for ByPolygonVertex mapping: ",
uvIndices.size(), ", expected ", vertex_count);
return;
}
@ -537,8 +537,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
}
}
else {
FBXImporter::LogError(Formatter::format("ignoring vertex data channel, access type not implemented: ")
<< MappingInformationType << "," << ReferenceInformationType);
FBXImporter::LogError("ignoring vertex data channel, access type not implemented: ",
MappingInformationType, ",", ReferenceInformationType);
}
}
@ -642,7 +642,7 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
if (MappingInformationType == "AllSame") {
// easy - same material for all faces
if (materials_out.empty()) {
FBXImporter::LogError(Formatter::format("expected material index, ignoring"));
FBXImporter::LogError("expected material index, ignoring");
return;
} else if (materials_out.size() > 1) {
FBXImporter::LogWarn("expected only a single material index, ignoring all except the first one");
@ -655,14 +655,14 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
materials_out.resize(face_count);
if(materials_out.size() != face_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")
<< materials_out.size() << ", expected " << face_count
FBXImporter::LogError("length of input data unexpected for ByPolygon mapping: ",
materials_out.size(), ", expected ", face_count
);
return;
}
} else {
FBXImporter::LogError(Formatter::format("ignoring material assignments, access type not implemented: ")
<< MappingInformationType << "," << ReferenceInformationType);
FBXImporter::LogError("ignoring material assignments, access type not implemented: ",
MappingInformationType, ",", ReferenceInformationType);
}
}
// ------------------------------------------------------------------------------------------------

View File

@ -315,7 +315,7 @@ void IFCImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// this must be last because objects are evaluated lazily as we process them
if (!DefaultLogger::isNullLogger()) {
LogDebug((Formatter::format(), "STEP: evaluated ", db->GetEvaluatedObjectCount(), " object records"));
LogDebug("STEP: evaluated ", db->GetEvaluatedObjectCount(), " object records");
}
}
@ -438,7 +438,7 @@ bool ProcessMappedItem(const Schema_2x3::IfcMappedItem &mapped, aiNode *nd_src,
bool got = false;
for (const Schema_2x3::IfcRepresentationItem &item : repr.Items) {
if (!ProcessRepresentationItem(item, localmatid, meshes, conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
IFCImporter::LogWarn("skipping mapped entity of type ", item.GetClassName(), ", no representations could be generated");
} else
got = true;
}
@ -856,7 +856,7 @@ void ProcessSpatialStructures(ConversionData &conv) {
if (!prod) {
continue;
}
IFCImporter::LogVerboseDebug("looking at spatial structure `" + (prod->Name ? prod->Name.Get() : "unnamed") + "`" + (prod->ObjectType ? " which is of type " + prod->ObjectType.Get() : ""));
IFCImporter::LogVerboseDebug("looking at spatial structure `", (prod->Name ? prod->Name.Get() : "unnamed"), "`", (prod->ObjectType ? " which is of type " + prod->ObjectType.Get() : ""));
// the primary sites are referenced by an IFCRELAGGREGATES element which assigns them to the IFCPRODUCT
const STEP::DB::RefMap &refs = conv.db.GetRefs();

View File

@ -76,64 +76,37 @@ public:
}
// ------------------------------------------------------------------------------------------------
static void LogError(const Formatter::format& message) {
template<typename... T>
static void LogError(T&&... args) {
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_ERROR(Prefix()+(std::string)message);
ASSIMP_LOG_ERROR(Prefix(), std::forward<T>(args)...);
}
}
// ------------------------------------------------------------------------------------------------
static void LogInfo(const Formatter::format& message) {
template<typename... T>
static void LogInfo(T&&... args) {
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_INFO(Prefix()+(std::string)message);
ASSIMP_LOG_INFO(Prefix(), std::forward<T>(args)...);
}
}
// ------------------------------------------------------------------------------------------------
static void LogDebug(const Formatter::format& message) {
template<typename... T>
static void LogDebug(T&&... args) {
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_DEBUG(Prefix()+(std::string)message);
}
}
static void LogVerboseDebug(const Formatter::format& message) {
if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_VERBOSE_DEBUG(Prefix()+(std::string)message);
}
}
// https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462
#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
// ------------------------------------------------------------------------------------------------
static void LogError (const char* message) {
if (!DefaultLogger::isNullLogger()) {
LogError(Formatter::format(message));
ASSIMP_LOG_DEBUG(Prefix(), std::forward<T>(args)...);
}
}
// ------------------------------------------------------------------------------------------------
static void LogInfo (const char* message) {
template<typename... T>
static void LogVerboseDebug(T&&... args) {
if (!DefaultLogger::isNullLogger()) {
LogInfo(Formatter::format(message));
ASSIMP_LOG_VERBOSE_DEBUG(Prefix(), std::forward<T>(args)...);
}
}
// ------------------------------------------------------------------------------------------------
static void LogDebug (const char* message) {
if (!DefaultLogger::isNullLogger()) {
LogDebug(Formatter::format(message));
}
}
// ------------------------------------------------------------------------------------------------
static void LogVerboseDebug (const char* message) {
if (!DefaultLogger::isNullLogger()) {
LogVerboseDebug(Formatter::format(message));
}
}
#endif
private:
static const char* Prefix();