format code and correct log message.