logging fully rewritten to use sockets instead of syscalls