cpplog
cpplog copied to clipboard
Functionality without boost?
Hi, I tried this library assuming that it was header-only as advertised and ran straight into compilation problems when trying the main.cpp. I removed the THREADING and SYSTEM_IDS as well as the boost libs from the Makefile and now I can build and all the threads pass.
Is there some documentation as to what I am missing out if I use the library in this way?
ifdef CPPLOG_SYSTEM_IDS seems to relate to printing process / thread ids.
ifdef CPPLOG_THREADING runs the logger in its own thread.
Can I still use the library without boost-thread using, say OpenMPI? What kind of shortcomings do I need to expect?
Best, Matthias
[–]andrew-d[S] 1 point 1 year ago
If you #define CPPLOG_NO_THREADING and CPPLOG_NO_SYSTEM_IDS, it doesn't depend on Boost any more - though you lose the ability to track process/thread IDs and the use of BackgroundLogger.
I found this on the related reddit thread: http://www.reddit.com/r/programming/comments/krd8f/show_proggit_a_simple_headeronly_mitlicensed_c/ so I guess I won't lose too much.
Could you still comment on the MPI interaction? (although for projects where I use that, I probably shouldn't be so picky about installing/building boost)
Hi there,
I've never tested it with MPI, but if you #define
the two variables, cpplog will only use standard C++ code. If you want all your logs to show up on the root process, you may have to write a custom logger, however. If you want to do this, see OstreamLogger
for a really simple example of how to do that. I'm not super familiar with MPI, but perhaps write a logger that will check if it's process 0 and use MPI_Isend
or MPI_Ibsend
to send log messages to the main process?
Hi, thanks for the comment. To clarify, you would assume that if I don't take care of it, I'd end up with one logfile per thread started, right?