code: def configure_file_logging(
      logger_obj: logging.Logger,
      log_file: Optional[Text],
      use_syslog: Optional[bool],
      syslog_address: Optional[Text] = None,
      syslog_port: Optional[int] = None,
      syslog_protocol: Optional[Text] = None,
  ) -> None:
      """Configure logging to a file.
  
      Args:
          logger_obj: Logger object to configure.
          log_file: Path of log file to write to.
          use_syslog: Add syslog as a logger.
          syslog_address: Adress of the syslog server.
          syslog_port: Port of the syslog server.
          syslog_protocol: Protocol with the syslog server
      """
      if use_syslog:
          formatter = logging.Formatter(
              "%(asctime)s [%(levelname)-5.5s] [%(process)d]"
              " %(message)s"
          )
          socktype = (
              SOCK_STREAM
              if syslog_protocol == TCP_PROTOCOL
              else SOCK_DGRAM
          )
          syslog_handler = logging.handlers.SysLogHandler(
              address=(syslog_address, syslog_port), socktype=socktype
          )
          syslog_handler.setLevel(logger_obj.level)
          syslog_handler.setFormatter(formatter)
          logger_obj.addHandler(syslog_handler)
      if log_file:
          formatter = logging.Formatter(
              "%(asctime)s [%(levelname)-5.5s]  %(message)s"
          )
          file_handler = logging.FileHandler(
              log_file, encoding=rasa.shared.utils.io.DEFAULT_ENCODING
          )
          file_handler.setLevel(logger_obj.level)
          file_handler.setFormatter(formatter)
          logger_obj.addHandler(file_handler)
  
imports: import json
  import logging
  import os
  from decimal import Decimal
  from pathlib import Path
  from typing import Any, Dict, Optional, Set, Text, Tuple, Union
  import numpy
  import rasa.shared.utils.io
  from rasa.constants import DEFAULT_SANIC_WORKERS, ENV_SANIC_WORKERS
  from rasa.shared.constants import DEFAULT_ENDPOINTS_PATH, TCP_PROTOCOL
  from rasa.core.lock_store import LockStore, RedisLockStore, InMemoryLockStore
  from rasa.utils.endpoints import EndpointConfig, read_endpoint_config
  from sanic import Sanic
  from socket import SOCK_DGRAM, SOCK_STREAM
  import rasa.cli.utils
label_desc: Use image node_id 1 for calling a global function with example usage: configure_file_logging(logger_obj, log_file, use_syslog, syslog_address, syslog_port, syslog_protocol) without return types