code: def update_logging_config(context, log_name=None, file_name='worker.log'):
      
      log_name = log_name or __name__.split('.')[0]
      top_level_logger = logging.getLogger(log_name)
  
      datefmt = context.config['log_datefmt']
      fmt = context.config['log_fmt']
      formatter = logging.Formatter(fmt=fmt, datefmt=datefmt)
  
      if context.config.get("verbose"):
          top_level_logger.setLevel(logging.DEBUG)
          if len(top_level_logger.handlers) == 0:
              handler = logging.StreamHandler()
              handler.setFormatter(formatter)
              top_level_logger.addHandler(handler)
      else:
          top_level_logger.setLevel(logging.INFO)
  
      # Rotating log file
      makedirs(context.config['log_dir'])
      path = os.path.join(context.config['log_dir'], file_name)
      if context.config["watch_log_file"]:
          # If we rotate the log file via logrotate.d, let's watch the file
          # so we can automatically close/reopen on move.
          handler = logging.handlers.WatchedFileHandler(path)
      else:
          # Avoid using WatchedFileHandler during scriptworker unittests
          handler = logging.FileHandler(path)
      handler.setFormatter(formatter)
      top_level_logger.addHandler(handler)
      top_level_logger.addHandler(logging.NullHandler())
docs: Update python logging settings from config.
  
      By default, this sets the ``scriptworker`` log settings, but this will
      change if some other package calls this function or specifies the ``log_name``.
  
      * Use formatting from config settings.
      * Log to screen if ``verbose``
      * Add a rotating logfile from config settings.
  
      Args:
          context (scriptworker.context.Context): the scriptworker context.
          log_name (str, optional): the name of the Logger to modify.
              If None, use the top level module ('scriptworker').
              Defaults to None.