format code & change log level

format code style and change log level to debug when there is no problem
with the connection