Skip to content

Commit

Permalink
Put the log into the err message so the CI actually shows it......
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed May 8, 2024
1 parent e18d608 commit cdd2c28
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions include/openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "openPMD/Error.hpp"
#include "openPMD/IO/ADIOS/macros.hpp"
#include "openPMD/config.hpp"
#include <sstream>

#if openPMD_HAVE_ADIOS2
#include "openPMD/Dataset.hpp"
Expand All @@ -40,6 +41,9 @@

namespace openPMD
{

extern std::stringstream debugging_log;

enum class GroupOrDataset
{
GROUP,
Expand Down
4 changes: 3 additions & 1 deletion include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ class ADIOS2IOHandlerImpl
errorMessage << "Trying to access a dataset with wrong type "
"(trying to access dataset with type '"
<< requiredType << "', but has type '"
<< actualType << "')";
<< actualType << "')\nLOG IS:\n"
<< debugging_log.str();
debugging_log.clear();
throw error::ReadError(
error::AffectedObject::Dataset,
error::Reason::UnexpectedContent,
Expand Down
11 changes: 9 additions & 2 deletions src/IO/ADIOS/ADIOS2Auxiliary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "openPMD/auxiliary/TypeTraits.hpp"
#include "openPMD/config.hpp"
#include <sstream>
#if openPMD_HAVE_ADIOS2
#include "openPMD/Datatype.hpp"
#include "openPMD/DatatypeHelpers.hpp"
Expand Down Expand Up @@ -271,9 +272,15 @@ normalizingVariableType(const adios2::IO &IO, const std::string &name)
auto const &unsanitized_result = IO.VariableType(name);
auto openpmd_type = fromADIOS2Type(unsanitized_result);
auto res = switchAdios2VariableType<ToDatatype>(openpmd_type);
std::cout << "[normalizingVariableType] for '" << name << "' " << res
<< " (non-normalized: " << unsanitized_result << ")" << std::endl;
debugging_log << "[normalizingVariableType] for '" << name << "' " << res
<< " (non-normalized: " << unsanitized_result << ")"
<< std::endl;
return res;
}

} // namespace openPMD::detail
namespace openPMD
{
std::stringstream debugging_log;
}
#endif
4 changes: 2 additions & 2 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ void ADIOS2IOHandlerImpl::openDataset(
auto &fileData = getFileData(file, IfFileNotOpen::ThrowError);
*parameters.dtype = detail::fromADIOS2Type(
detail::normalizingVariableType(fileData.m_IO, varName));
std::cout << "[openDataset] opened '" << varName << "'as "
<< *parameters.dtype << std::endl;
debugging_log << "[openDataset] opened '" << varName << "'as "
<< *parameters.dtype << std::endl;
switchAdios2VariableType<detail::DatasetOpener>(
*parameters.dtype, this, file, varName, parameters);
writable->written = true;
Expand Down

0 comments on commit cdd2c28

Please sign in to comment.