docs: def init_app(app):
      """
      Enables logging for an app using :class:`LocalVarFormatter`. Requires the
      app to be configured and checks for the following configuration parameters.
      All are optional:
  
      * ``LOGFILE``: Name of the file to log to (default ``error.log``)
      * ``ADMINS``: List of email addresses of admins who will be mailed error reports
      * ``MAIL_DEFAULT_SENDER``: From address of email. Can be an address or a tuple with name and address
      * ``MAIL_SERVER``: SMTP server to send with (default ``localhost``)
      * ``MAIL_USERNAME`` and ``MAIL_PASSWORD``: SMTP credentials, if required
      * ``SLACK_LOGGING_WEBHOOKS``: If present, will send error logs to all specified Slack webhooks
      * ``ADMIN_NUMBERS``: List of mobile numbers of admin to send SMS alerts. Requires the following values too
      * ``SMS_EXOTEL_SID``: Exotel SID for Indian numbers (+91 prefix)
      * ``SMS_EXOTEL_TOKEN``: Exotel token
      * ``SMS_EXOTEL_FROM``: Exotel sender's number
      * ``SMS_TWILIO_SID``: Twilio SID for non-Indian numbers
      * ``SMS_TWILIO_TOKEN``: Twilio token
      * ``SMS_TWILIO_FROM``: Twilio sender's number
  
      Format for ``SLACK_LOGGING_WEBHOOKS``::
  
          SLACK_LOGGING_WEBHOOKS = [{
              'levelnames': ['WARNING', 'ERROR', 'CRITICAL'],
              'url': 'https://hooks.slack.com/...'
              }]
  
      """
      formatter = LocalVarFormatter()
  
      error_log_file = app.config.get('LOGFILE', 'error.log')
      if error_log_file:  # Specify a falsy value in config to disable the log file
          file_handler = logging.FileHandler(error_log_file)
          file_handler.setFormatter(formatter)
          file_handler.setLevel(logging.WARNING)
          app.logger.addHandler(file_handler)
  
      if app.config.get('ADMIN_NUMBERS'):
          if all(key in app.config for key in ['SMS_EXOTEL_SID', 'SMS_EXOTEL_TOKEN', 'SMS_EXOTEL_FROM',
                  'SMS_TWILIO_SID', 'SMS_TWILIO_TOKEN', 'SMS_TWILIO_FROM']):
  
              # A little trickery because directly creating
              # an SMSHandler object didn't work
              logging.handlers.SMSHandler = SMSHandler
  
              sms_handler = logging.handlers.SMSHandler(
                  app_name=app.name,
                  exotel_sid=app.config['SMS_EXOTEL_SID'],
                  exotel_token=app.config['SMS_EXOTEL_TOKEN'],
                  exotel_from=app.config['SMS_EXOTEL_FROM'],
                  twilio_sid=app.config['SMS_TWILIO_SID'],
                  twilio_token=app.config['SMS_TWILIO_TOKEN'],
                  twilio_from=app.config['SMS_TWILIO_FROM'],
                  phonenumbers=app.config['ADMIN_NUMBERS'])
              sms_handler.setLevel(logging.ERROR)
              app.logger.addHandler(sms_handler)
  
      if app.config.get('SLACK_LOGGING_WEBHOOKS'):
          logging.handlers.SlackHandler = SlackHandler
          slack_handler = logging.handlers.SlackHandler(
              app_name=app.name, webhooks=app.config['SLACK_LOGGING_WEBHOOKS'])
          slack_handler.setFormatter(formatter)
          slack_handler.setLevel(logging.NOTSET)
          app.logger.addHandler(slack_handler)
  
      if app.config.get('ADMINS'):
          # MAIL_DEFAULT_SENDER is the new setting for default mail sender in Flask-Mail
          # DEFAULT_MAIL_SENDER is the old setting. We look for both
          mail_sender = app.config.get('MAIL_DEFAULT_SENDER') or app.config.get(
              'DEFAULT_MAIL_SENDER', 'logs@example.com')
          if isinstance(mail_sender, (list, tuple)):
              mail_sender = mail_sender[1]  # Get email from (name, email)
          if app.config.get('MAIL_USERNAME') and app.config.get('MAIL_PASSWORD'):
              credentials = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
          else:
              credentials = None
          mail_handler = logging.handlers.SMTPHandler(app.config.get('MAIL_SERVER', 'localhost'),
              mail_sender,
              app.config['ADMINS'],
              '%s failure' % app.name,
              credentials=credentials)
          mail_handler.setFormatter(formatter)
          mail_handler.setLevel(logging.ERROR)
          app.logger.addHandler(mail_handler)