From 1940cf8413dee0cdf4e07b1968f88f6fc9bd8a40 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 26 May 2016 14:57:15 +0100 Subject: [PATCH] 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 --- src/OpenFOAM/db/error/messageStream.H | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/db/error/messageStream.H b/src/OpenFOAM/db/error/messageStream.H index 2fcc531809..54ef0fe664 100644 --- a/src/OpenFOAM/db/error/messageStream.H +++ b/src/OpenFOAM/db/error/messageStream.H @@ -281,6 +281,10 @@ extern messageStream Info; // for FUNCTION_NAME in file __FILE__ at line __LINE__ #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 // for functionName in file __FILE__ at line __LINE__ @@ -305,17 +309,16 @@ extern messageStream Info; #define DebugInFunction \ if (debug) InfoInFunction - //- Report a variable name and value // using Foam::Pout in file __FILE__ at line __LINE__ #define DebugVar(var) \ - ::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] " \ - << #var " " << var << ::Foam::endl - - -//- Report write to Foam::Info if the local log switch is true -#define Log \ - if (log) Info +{ \ + ::Foam::string oldPrefix(::Foam::Pout.prefix()); \ + ::Foam::Pout<< "["<< __FILE__ << ":" << __LINE__ << "] "; \ + ::Foam::Pout.prefix() = oldPrefix + #var " "; \ + ::Foam::Pout<< var << ::Foam::endl; \ + ::Foam::Pout.prefix() = oldPrefix; \ +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //