diff --git a/docs/Highlighted Features/Log-System.md b/docs/Highlighted Features/Log-System.md index 4db57c8b5f6b54365334b87f5190dcaf3c44076f..fe1ae84b4855e35eb13c36565472f906351759ba 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: