refactor logging in TcpServer