write logger function
replce getClientIP function on more stable