csv gen and logging