From 5dffe143b8c11aa8893190901d9be1c7d9695157 Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Wed, 5 Feb 2020 18:29:29 +0100 Subject: [PATCH] Update Log-System.md --- docs/Highlighted Features/Log-System.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/Highlighted Features/Log-System.md b/docs/Highlighted Features/Log-System.md index 4db57c8..fe1ae84 100644 --- a/docs/Highlighted Features/Log-System.md +++ b/docs/Highlighted Features/Log-System.md @@ -336,15 +336,23 @@ Stylishly speaking, omitting the semi-column also remind the developer that the ### Pretty print pointer value -Sometimes it is quite handy to print the address where a pointer `myPointer` is pointing to. In order to do that you can use this specific trick to get a pretty print: +Sometimes it is quite handy to print the address where a pointer `myPointer` is pointing to. In order to do that you, you can use the CamiTK helper macro `CAMITK_PRINT_POINTER`. + +For instance, to print the pointer `myPointer` declared as `AnyClass*`, you can write: ```C++ -CAMITK_TRACE(QString("0x%1").arg((quintptr)myPointer, QT_POINTER_SIZE * 2, 16, QChar('0'))) +CAMITK_INFO(tr("checking ") + CAMITK_PRINT_POINTER(myPointer)) ``` -This will print something like: +This will print: ``` -0x00005632e5fd5af0 +checking myPointer=0x00005632e5fd5af0 ``` +For your information, the macro is defined like this: +```C++ +#define CAMITK_PRINT_POINTER(PTR) (QString(#PTR) + QString("=0x%1").arg((quintptr)PTR, QT_POINTER_SIZE * 2, 16, QChar('0'))) +``` + + ## To go further A lot of other things are possible with the CamiTK log system: -- GitLab