
Stefan Seefeld wrote:
John Torjo wrote:
Dear boosters,
Worked some more on the logging library, and here's what's new:
- added ***documentation*** - added samples - made static library (improved compilation times) - added efficient thread-safe logger, which does the logging on a dedicated thread
why do you route the log to a different thread instead of writing it directly ? On the one hand you provide macros to be able to optimize the logger code away if it is not desired, on the other hand you accept a full context switch (and mutex lock and...) for each single message !
Note that this (the efficient thread-safe logger) is just one of the possible loggers that come with the library - see the documentation. Note: when allowing to optimize away logs (note: not loggers!), it's a whole different story. A log can end up (if enabled) to call multiple functions - loggers and/or modifier functions. One of the loggers is the thread-safe logger/ on a dedicated thread. Take a look at multiple_threads sample and maybe you'll understand better. Please let me know if there are any more issues. Thanks.
May be, if you want to be fancy and fashionable, you could put this kind of 'strategy' into a trait...
Actually, it is a 'strategy' ;) see above. Best, John -- John Torjo Freelancer -- john@torjo.com -- http://www.torjo.com/logview/ - viewing/filtering logs is just too easy!