Moved export CSV code to Log.