logger with main function