revise log handling

All the log-related operations are calling functions in util.go. This makes
the consistancy of the logs.
Merge pull request #45 from ccding/master

revise log handling