log function codegen rewrite begin
prettier code gen and unittest split
more fixes