From 665e15dd8ca4df355dc7eb87eeb895357bfc85c5 Mon Sep 17 00:00:00 2001 From: Felix Schindler <felix.schindler@wwu.de> Date: Wed, 25 Nov 2020 12:25:45 +0100 Subject: [PATCH] [common] add convenience LOG macro --- dune/xt/common/timedlogging.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dune/xt/common/timedlogging.hh b/dune/xt/common/timedlogging.hh index 31023d55f..230eb8517 100644 --- a/dune/xt/common/timedlogging.hh +++ b/dune/xt/common/timedlogging.hh @@ -127,6 +127,15 @@ public: }; // class DefaultLogger +/// \brief Convenience macro for enrivonments with a logger variable +#ifdef LOG +# error Macro LOG already defined, open an issue at https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt/-/issues ! +#else +# define LOG(type) \ + if (logger.type##_enabled()) \ + logger.type() +#endif + /// \brief Convenience macro for classes with a logger member #ifdef LOG_ # error Macro LOG_ already defined, open an issue at https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt/-/issues ! -- GitLab