reworked logging to support more complex thread-safe operations