Pass around non-static logger instances and programmatic access to messages in-memory

This commit is contained in:
Thomas Krijnen
2026-06-10 18:30:54 +02:00
parent a751fb956d
commit a7738eeb64
132 changed files with 1029 additions and 884 deletions
+17 -17
View File
@@ -86,7 +86,7 @@ bool IfcGeom::util::approximate_plane_through_wire(const TopoDS_Wire& wire, gp_P
// obtaining a 2d points for the Delaunay, infinity is passed here, so this
// can't for assessing degenerativeness.
if (v.Magnitude() < 1.e-7) {
Logger::Warning("GEO", 215, "Degenerate face boundary in normal estimation");
Logger::Root().Warning("GEO", 215, "Degenerate face boundary in normal estimation");
return false;
}
@@ -233,7 +233,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
auto it = mapping.find(uvnodes[k]);
if (it == mapping.end()) {
Logger::Error("GEO", 216, "Internal error: unable to unproject uv-mesh");
Logger::Root().Error("GEO", 216, "Internal error: unable to unproject uv-mesh");
return TRIANGULATE_WIRE_FAIL;
}
@@ -277,7 +277,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
}
faces.Append(triangle_face);
} else {
Logger::Error("GEO", 217, "Internal error: missing face");
Logger::Root().Error("GEO", 217, "Internal error: missing face");
return TRIANGULATE_WIRE_FAIL;
}
}
@@ -308,7 +308,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
if (!contains) {
#endif
// All existing edges need to exist in the new faces
Logger::Error("GEO", 218, "Internal error, missing edge from triangulation");
Logger::Root().Error("GEO", 218, "Internal error, missing edge from triangulation");
non_manifold = true;
}
}
@@ -319,7 +319,7 @@ IfcGeom::util::triangulate_wire_result IfcGeom::util::triangulate_wire(const std
// Existing edges are boundaries with use 1
// New edges are internal with use 2
if (n != (mape.Contains(v) ? 1 : 2)) {
Logger::Error("GEO", 219, "Internal error, non-manifold result from triangulation");
Logger::Root().Error("GEO", 219, "Internal error, non-manifold result from triangulation");
non_manifold = true;
}
}
@@ -790,12 +790,12 @@ bool IfcGeom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape
shape = solid.SolidFromShell(TopoDS::Shell(shape));
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error("GEO", 220, e.GetMessageString());
Logger::Root().Error("GEO", 220, e.GetMessageString());
} else {
Logger::Error("GEO", 221, "Unknown error creating solid");
Logger::Root().Error("GEO", 221, "Unknown error creating solid");
}
} catch (...) {
Logger::Error("GEO", 222, "Unknown error creating solid");
Logger::Root().Error("GEO", 222, "Unknown error creating solid");
}
return true;
@@ -808,12 +808,12 @@ bool IfcGeom::util::convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoD
return true;
} catch (const Standard_Failure& e) {
if (e.GetMessageString() && strlen(e.GetMessageString())) {
Logger::Error("GEO", 223, e.GetMessageString());
Logger::Root().Error("GEO", 223, e.GetMessageString());
} else {
Logger::Error("GEO", 224, "Unknown error converting curve to wire");
Logger::Root().Error("GEO", 224, "Unknown error converting curve to wire");
}
} catch (...) {
Logger::Error("GEO", 225, "Unknown error converting curve to wire");
Logger::Root().Error("GEO", 225, "Unknown error converting curve to wire");
}
return false;
}
@@ -834,7 +834,7 @@ void IfcGeom::util::assert_closed_wire(TopoDS_Wire& wire, double tol) {
wire = mw.Wire();
}
Logger::Warning("GEO", 226, "Wire not closed");
Logger::Root().Warning("GEO", 226, "Wire not closed");
}
}
@@ -844,7 +844,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
TopTools_ListOfShape results;
if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) {
Logger::Warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
Logger::Root().Warning("GEO", 227, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
util::select_largest(results, wire);
}
@@ -875,7 +875,7 @@ bool IfcGeom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS_Face& face
BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("GEO", 228, "Failed to create face.");
Logger::Root().Error("GEO", 228, "Failed to create face.");
return false;
}
face = mf.Face();
@@ -902,7 +902,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
TopTools_ListOfShape results;
if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) {
Logger::Warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
Logger::Root().Warning("GEO", 229, "Self-intersections with " + boost::lexical_cast<std::string>(results.Extent()) + " cycles detected");
} else {
results.Clear();
results.Append(w);
@@ -928,7 +928,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
BRepBuilderAPI_FaceError er = mf.Error();
if (er != BRepBuilderAPI_FaceDone) {
Logger::Error("GEO", 230, "Failed to create face.");
Logger::Root().Error("GEO", 230, "Failed to create face.");
continue;
}
@@ -945,7 +945,7 @@ bool IfcGeom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoDS_Compound&
if (p.first >= max_area / 10.) {
B.Add(faces, p.second);
} else {
Logger::Warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
Logger::Root().Warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast<std::string>(p.first));
}
}