Outputting a logo from the Wordpress Customiser
Here are my  suggestions:

There is no point of "fetching" the image url if has_custom_logo returns false.

Instead, I would define $logo with a default value, then, if has_custom_logo is true, I would just rewrite it's value.

$logo = get_template_directory_uri() . '/img/logo.png';

if(has_custom_logo()){
  $logos = wp_get_attachment_image_src(get_theme_mod('custom_logo'), 'full');
  $logo  = reset($logos);
}

echo sprintf('&lt;img src="%s" /&gt;', esc_url($logo));


I'm using reset method, it 


  rewinds array's internal pointer to the first element and returns the
  value of the first array element.


You can convert this to a method and use it in multiple places.