rewrite logging; split into multi files; add file logger