refactor log writer
add api for dama