Re-organize the structured logging code to separate the TCP transport handling from the JSON formatting.