messageStream: Updated 'DebugVar' to handle multi-line object output

Resolves feature-request http://bugs.openfoam.org/view.php?id=2101
Patch contributed by Mattijs Janssens
This commit is contained in:
Henry Weller 2016-05-26 14:57:15 +01:00
parent 5976e79ceb
commit bf71b29434

View file

@ -281,6 +281,10 @@ extern messageStream Info;
// for FUNCTION_NAME in file __FILE__ at line __LINE__ // for FUNCTION_NAME in file __FILE__ at line __LINE__
#define InfoInFunction InfoIn(FUNCTION_NAME) #define InfoInFunction InfoIn(FUNCTION_NAME)
//- Report write to Foam::Info if the local log switch is true
#define Log \
if (log) Info
//- Report an IO information message using Foam::Info //- Report an IO information message using Foam::Info
// for functionName in file __FILE__ at line __LINE__ // for functionName in file __FILE__ at line __LINE__
@ -305,17 +309,16 @@ extern messageStream Info;
#define DebugInFunction \ #define DebugInFunction \
if (debug) InfoInFunction if (debug) InfoInFunction
//- Report a variable name and value //- Report a variable name and value
// using Foam::Pout in file __FILE__ at line __LINE__ // using Foam::Pout in file __FILE__ at line __LINE__
#define DebugVar(var) \ #define DebugVar(var) \
::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] " \ { \
<< #var " " << var << ::Foam::endl ::Foam::string oldPrefix(::Foam::Pout.prefix()); \
::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] "; \
::Foam::Pout.prefix() = oldPrefix + #var " "; \
//- Report write to Foam::Info if the local log switch is true ::Foam::Pout<< var << ::Foam::endl; \
#define Log \ ::Foam::Pout.prefix() = oldPrefix; \
if (log) Info }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //