Added unit tests for metrics logging. Refactored the logMetrics() function to allow for easier testing