Checks if a logger is passed before calling it