mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add InfoErr stream. Same as Info, but with stderr instead of stdout
This commit is contained in:
committed by
Andrew Heather
parent
5213a4aa9d
commit
e3d4d79300
@ -200,48 +200,41 @@ Foam::messageStream::operator Foam::OSstream&()
|
||||
{
|
||||
if (level)
|
||||
{
|
||||
const bool collect = (severity_ == INFO || severity_ == WARNING);
|
||||
const bool collect =
|
||||
(
|
||||
severity_ == INFO
|
||||
|| severity_ == INFO_STDERR
|
||||
|| severity_ == WARNING
|
||||
);
|
||||
|
||||
// Report the error
|
||||
|
||||
// Could add guard with parRun
|
||||
if (collect && !Pstream::master())
|
||||
{
|
||||
return Snull;
|
||||
}
|
||||
else
|
||||
|
||||
OSstream& os =
|
||||
(
|
||||
(collect || !Pstream::parRun())
|
||||
? ((severity_ == INFO_STDERR) ? Serr : Sout)
|
||||
: Pout
|
||||
);
|
||||
|
||||
|
||||
if (!title().empty())
|
||||
{
|
||||
if (!title().empty())
|
||||
{
|
||||
if (collect || !Pstream::parRun())
|
||||
{
|
||||
Sout<< title().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< title().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (maxErrors_)
|
||||
{
|
||||
++errorCount_;
|
||||
|
||||
if (errorCount_ >= maxErrors_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Too many errors"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (collect || !Pstream::parRun())
|
||||
{
|
||||
return Sout;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Pout;
|
||||
}
|
||||
os << title().c_str();
|
||||
}
|
||||
|
||||
if (maxErrors_ && (++errorCount_ >= maxErrors_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Too many errors"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
return Snull;
|
||||
@ -252,6 +245,8 @@ Foam::messageStream::operator Foam::OSstream&()
|
||||
|
||||
Foam::messageStream Foam::Info("", messageStream::INFO);
|
||||
|
||||
Foam::messageStream Foam::InfoErr("", messageStream::INFO_STDERR);
|
||||
|
||||
Foam::messageStream Foam::Warning
|
||||
(
|
||||
"--> FOAM Warning : ",
|
||||
|
||||
Reference in New Issue
Block a user