Implement and leverage conditional logging with $log