How to easily log exceptions in Drupal 8

watchdog_exception('example_module', $exception);

Soon but not yet it should be:

\Drupal::logException('example_module', $exception);

See watchdog_exception replaced by \Drupal::logException()

\Drupal::logger('drutopia_findit_search')->notice('Age terms are here: %what.', ['%what' => $age_terms ? 'yes' : 'no']);
\Drupal::logger('drutopia_findit_search')->error('Unexpected result of term name: %term.', ['%term' => $term->name]);
   if (!is_array($types)) {
      \Drupal::logger('drutopia_findit_search')->error('%types is not an array.', ['%types' => $types]);
    }
use Drupal\Core\Utility\UpdateException;
/**
 * Install rabbit hole module dependencies.
 */
function nichq_community_user_update_8005() {
  $module_name = 'rabbit_hole';
  if (!\Drupal::moduleHandler()->moduleExists($module_name)) {
    try {
      \Drupal::service('module_installer')->install([$module_name]);
    }
    catch (Exception $e) {
      watchdog_exception('nichq_community_user', $e);
      throw new UpdateException('The [module title] module is required but was not found.');
    }
  }
}