Move logging functions to a separate script