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
+6 -6
View File
@@ -53,8 +53,8 @@ static const uint32_t PRIM_TRIANGLE_FAN = 6;
static const uint32_t ELEMENT_ARRAY_BUFFER = 34963;
static const uint32_t ARRAY_BUFFER = 34962;
GltfSerializer::GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings)
: WriteOnlyGeometrySerializer(geometry_settings, settings)
GltfSerializer::GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger)
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
, filename_(filename)
, tmp_filename1_(filename + ".indices.tmp")
, tmp_filename2_(filename + ".vertices.tmp")
@@ -519,7 +519,7 @@ namespace {
}
void proj_log(void *, int, const char* c) {
Logger::Error("SER", 1, "PROJ: " + std::string(c));
logger_.Error("SER", 1, "PROJ: " + std::string(c));
}
}
@@ -650,7 +650,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
NULL);
if (!P) {
Logger::Error("SER", 2, "Failed to create PROJ transformation object");
logger_.Error("SER", 2, "Failed to create PROJ transformation object");
return;
}
@@ -662,7 +662,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
wgs84_point = proj_trans(P, PJ_FWD, a);
Logger::Notice("SER", 3, "Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
logger_.Notice("SER", 3, "Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
}
std::swap(wgs84_point.lp.phi, wgs84_point.lp.lam);
@@ -687,7 +687,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
PJ *ellipsoid_crs = proj_create(C, ellipsoid_def);
if (!ellipsoid_crs) {
Logger::Error("SER", 4, "Failed to create ellipsoid CRS");
logger_.Error("SER", 4, "Failed to create ellipsoid CRS");
return;
}