diff --git a/src/OpenFOAM/db/error/IOerror.C b/src/OpenFOAM/db/error/IOerror.C index 6d632a254eebf1c4d761a9911f456279c86d624a..a60012f037db19ffc6a043880005ea589c8b6676 100644 --- a/src/OpenFOAM/db/error/IOerror.C +++ b/src/OpenFOAM/db/error/IOerror.C @@ -268,9 +268,16 @@ void Foam::IOerror::write(Ostream& os, const bool includeTitle) const os << nl; if (includeTitle && !title().empty()) { - os << title().c_str() << nl; - } + os << title().c_str() + << "(openfoam-" << foamVersion::api; + if (foamVersion::patched()) + { + // Patch-level, when defined + os << " patch=" << foamVersion::patch.c_str(); + } + os << ')' << nl; + } os << message().c_str(); diff --git a/src/OpenFOAM/db/error/error.C b/src/OpenFOAM/db/error/error.C index 380d521621267427be99f2f9600065005be1f777..d6ac9f1d2fd2f0e13ba800121c2eae65074d6c03 100644 --- a/src/OpenFOAM/db/error/error.C +++ b/src/OpenFOAM/db/error/error.C @@ -300,7 +300,15 @@ void Foam::error::write(Ostream& os, const bool includeTitle) const os << nl; if (includeTitle && !title().empty()) { - os << title().c_str() << nl; + os << title().c_str() + << "(openfoam-" << foamVersion::api; + + if (foamVersion::patched()) + { + // Patch-level, when defined + os << " patch=" << foamVersion::patch.c_str(); + } + os << ')' << nl; } os << message().c_str(); diff --git a/src/OpenFOAM/db/error/messageStream.C b/src/OpenFOAM/db/error/messageStream.C index 03cb1962c3b5805e54fac7b3bc43d5fc67b3143c..0d6778ef35c1ceec535dfa52b924605a419d1eaa 100644 --- a/src/OpenFOAM/db/error/messageStream.C +++ b/src/OpenFOAM/db/error/messageStream.C @@ -35,6 +35,8 @@ License // Default is 2 : report source file name and line number if available int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2)); +int Foam::messageStream::redirect(0); + // Default is 1 : report to Info int Foam::infoDetailLevel(1); @@ -212,35 +214,33 @@ Foam::messageStream::operator Foam::OSstream&() { if (level) { - // stderr instead of stdout - // - INFO_STDERR - // - WARNING when infoDetailLevel == 0 - const bool useSerr = - ( - (severity_ == INFO_STDERR) - || (severity_ == WARNING && Foam::infoDetailLevel == 0) - ); - const bool collect = ( severity_ == INFO || severity_ == WARNING - || useSerr + || severity_ == INFO_STDERR ); - // Could add guard with parRun if (collect && !Pstream::master()) { return Snull; } + // Use stderr instead of stdout + // - INFO_STDERR + // - WARNING when infoDetailLevel == 0 + const bool useStderr = + ( + (severity_ == INFO_STDERR) + || (severity_ == WARNING && Foam::infoDetailLevel == 0) + ); OSstream& os = ( (collect || !Pstream::parRun()) - ? (useSerr ? Serr : Sout) - : Pout + ? (useStderr ? Serr : Sout) + : (useStderr ? Perr : Pout) ); diff --git a/src/OpenFOAM/db/error/messageStream.H b/src/OpenFOAM/db/error/messageStream.H index cff2c8a19838c17e499a5ee2bbb2f98072fdd86c..1ab03aa95bee3972e7a27d3fee3caf166a6a0b3c 100644 --- a/src/OpenFOAM/db/error/messageStream.H +++ b/src/OpenFOAM/db/error/messageStream.H @@ -98,7 +98,7 @@ public: // Static Data - //- Control the output verbosity of messageStream + //- The output level (verbosity) of messages // // - level == 0 : suppress all output // - level == 1 : normal output @@ -107,6 +107,11 @@ public: // \note The default level is normally 2. static int level; + //- The output redirection of messages + // + // - redirect == 2 : use stderr instead of stdout + static int redirect; + // Constructors