Converted logging code to module