Code for logging factory