pp - power print, has no intention to replace a Log-Framework - it's more a hacking tool.
In the code you could write_bytes like this:
pp(); // empty line
pp("$", a);
pp("$, $, $", a, b, c);
pp("val=$", 3.14);
pp("point=$", pt); // works if "<<" is overwritten
$ is an universal placeholder for all kind of objects. Any types which you can print out with std::cout are akcepted.
pp is much more simple as printf(). Also thread save and type save.
If you want to print out a "Point" or a "Line" compiler will complain.
We have same operator << over-write_bytes rules like std::cout.
To see your own types just overwrite << and it will work.
pp is implemented by the variadic templates mechanismus. - No macros!
Console lines like ...
[005243] [16:38:37,388956] [000000] LOG: 192.168.004.116:43224, GET /css/base.css?ver=62, ID:HZZRHUEAASBHRULDUDST, l:en
[005244] [16:38:37,389002] [015234] Calculation in progress...
[005245] [16:38:37,389013] [015234] Calculation done
...have 4 columns.
1. Continuous messages number
2. Timestamp: Time,Microseconds
3. Thread ID - [000000] marks the main-thread. This is possible if we call pp_set_thread_ID_main(); in begin of main(..) method
Otherwise you do not see [000000]. You see the real main thread-id, which always is unique in different program instances.
4. Message - what ever is important :-)
Why ? - Motivation
Time pressure - ok, i explain.
Lots of programers would use debugger. I rarely do. Within multithread program, special time conditions i won't disturb the program.
It must run and tell me whats going on. This can be done by logging. If customer has good logging functionality i can use it.
But if not ....I often need a fast solution for a quick overview. So use some kind of log lib ? Modify makefiles ? Mmmmh.
What I do is: Modify one header file. Call pp(..) where its need. Thats all.