code cleanup

it still under heavy development.
add logformat api