Header Logo as Text or Image

I have the below client requirement:
1) If the client sets an image for their header logo, use the image as their header logo.
2) Else, display the Blog Title as the header logo

Could someone provide a snippet of code that I can put in my child theme to solve this issue?