Split the logging code into separate files