Write log to disk and don't use threading and switch to deque instead of a socket queue