Skip to content

Commit

Permalink
Merge pull request #248 from inviwo/feature/logging
Browse files Browse the repository at this point in the history
Misc,TensorVis,VectorVis: core logging changes
  • Loading branch information
petersteneteg authored Jan 14, 2025
2 parents 0816787 + 89340c9 commit f035dd7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ void EventLogger<Inport, Outport>::invokeEvent(Event* event) {
const auto it = eventMap_.find(event->hash());
if ((it == eventMap_.end() && enableOtherEvents_.get()) ||
(it != eventMap_.end() && it->second.get())) {
LogProcessorInfo(std::setw(15) << getDisplayName() << " " << *event);
std::ostringstream oss;
event->print(oss);
log::info("Processor {:>15}: {}", getDisplayName(), oss.str());
}
}

Expand Down
12 changes: 4 additions & 8 deletions misc/openmesh/src/utils/openmeshconverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ void createVertexBuffers(TriMesh& mesh, const Mesh& inmesh, TransformCoordinates
return vec3(tmp) / tmp.w;
});
} else {
throw inviwo::Exception("Unknown position buffer type",
IvwContextCustom("openmeshutil::meshHelper"));
throw inviwo::Exception("Unknown position buffer type");
}
}
}
Expand All @@ -135,8 +134,7 @@ void createVertexBuffers(TriMesh& mesh, const Mesh& inmesh, TransformCoordinates
mesh.set_normal(VH(i++), {n.x, n.y, n.z});
}
} else {
throw inviwo::Exception("Unknown normals buffer type",
IvwContextCustom("openmeshutil::meshHelper"));
throw inviwo::Exception("Unknown normals buffer type");
}
} else if (buf.first.type == BufferType::ColorAttrib) {
auto loop = [&](auto& buf, auto toVec4) {
Expand All @@ -156,8 +154,7 @@ void createVertexBuffers(TriMesh& mesh, const Mesh& inmesh, TransformCoordinates
} else if (auto u3 = std::dynamic_pointer_cast<const Buffer<glm::u8vec3>>(buf.second)) {
loop(u3, [](glm::u8vec3 v) { return vec4(v, 255.0f) / 255.0f; });
} else {
throw inviwo::Exception("Unknown normals buffer type",
IvwContextCustom("openmeshutil::meshHelper"));
throw inviwo::Exception("Unknown normals buffer type");
}
} else if (buf.first.type == BufferType::TexCoordAttrib) {
if (auto t1 = std::dynamic_pointer_cast<const Buffer<float>>(buf.second)) {
Expand All @@ -181,8 +178,7 @@ void createVertexBuffers(TriMesh& mesh, const Mesh& inmesh, TransformCoordinates
mesh.set_texcoord3D(VH(i++), {v.x, v.y, v.z});
}
} else {
throw inviwo::Exception("Unknown normals buffer type",
IvwContextCustom("openmeshutil::meshHelper"));
throw inviwo::Exception("Unknown normals buffer type");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ void InvariantSpaceFilter::process() {
}
}

LogProcessorInfo(
std::to_string((float(numberOfFilteredTensors) / float(numberOfElements)) * 100.f)
<< "% filtered (" << std::to_string(numberOfFilteredTensors) << " out of "
<< std::to_string(numberOfElements) << ").");
log::info("{}% filtered ({} out of {})",
(float(numberOfFilteredTensors) / float(numberOfElements)) * 100.f,
numberOfFilteredTensors, numberOfElements);

invariantSpaceOutport_.setData(filteredInvariantSpace);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ IntegralLinesToDataFrame::MetaDataSettings* IntegralLinesToDataFrame::geMetaData
if (auto mdp = dynamic_cast<MetaDataSettings*>(p)) {
return mdp;
}
throw inviwo::Exception("Not a MetaDataSettings", IvwContext);
throw inviwo::Exception("Not a MetaDataSettings");
}
auto newProp = std::make_unique<MetaDataSettings>(id, key);
auto newPropPtr = newProp.get();
Expand Down

0 comments on commit f035dd7

Please sign in to comment.