ENH: suppress Info output for some cases (issue #722, #893)

- add additional control via a Foam::infoDetailLevel flag, which is
  supported by a 'DetailLevel' macro.  Eg,

      DetailLevel << "some information" << nl

- When infoDetailLevel is zero, the stdout for all Foam::system() calls
  are also redirected to stderr to prevent child output from
  appearing on the parent.

- close stdin before exec in system call.
This commit is contained in:
Mark Olesen
2018-06-22 12:26:33 +02:00
parent 83c9d3b287
commit 6390c18381
20 changed files with 260 additions and 211 deletions

View File

@ -29,8 +29,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// Default is 2 : report source file name and line number if available
int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
// Default is 1 : report to Info
int Foam::infoDetailLevel(1);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -72,10 +76,8 @@ Foam::OSstream& Foam::messageStream::masterStream(const label communicator)
{
return operator()();
}
else
{
return Snull;
}
return Snull;
}
@ -217,7 +219,7 @@ Foam::messageStream::operator Foam::OSstream&()
if (maxErrors_)
{
errorCount_++;
++errorCount_;
if (errorCount_ >= maxErrors_)
{
@ -244,12 +246,7 @@ Foam::messageStream::operator Foam::OSstream&()
// * * * * * * * * * * * * * * * Global Variables * * * * * * * * * * * * * //
Foam::messageStream Foam::SeriousError
(
"--> FOAM Serious Error : ",
messageStream::SERIOUS,
100
);
Foam::messageStream Foam::Info("", messageStream::INFO);
Foam::messageStream Foam::Warning
(
@ -257,7 +254,12 @@ Foam::messageStream Foam::Warning
messageStream::WARNING
);
Foam::messageStream Foam::Info("", messageStream::INFO);
Foam::messageStream Foam::SeriousError
(
"--> FOAM Serious Error : ",
messageStream::SERIOUS,
100
);
// ************************************************************************* //