Implements logging in