code tidy up

logger tidy up

private serialize and deserialize func