creating log in function