code: def getLogger(cls):
          
          # Only do the setup once, so we don't add a handler every time we log. Use a lock to do
          # so safely even if we're being called in different threads. Use double-checked locking
          # to reduce the overhead introduced by the lock.
          if cls.logger is None:
              with cls.lock:
                  if cls.logger is None:
                      cls.logger = logging.getLogger('toil-rt')
                      try:
                          level = os.environ[cls.envPrefix + 'LEVEL']
                      except KeyError:
                          # There is no server running on the leader, so suppress most log messages
                          # and skip the UDP stuff.
                          cls.logger.setLevel(logging.CRITICAL)
                      else:
                          # Adopt the logging level set on the leader.
                          toil.lib.bioio.setLogLevel(level, cls.logger)
                          try:
                              address = os.environ[cls.envPrefix + 'ADDRESS']
                          except KeyError:
                              pass
                          else:
                              # We know where to send messages to, so send them.
                              host, port = address.split(':')
                              cls.logger.addHandler(JSONDatagramHandler(host, int(port)))
          return cls.logger
docs: Get the logger that logs real-time to the leader.
          
          Note that if the returned logger is used on the leader, you will see the message twice,
          since it still goes to the normal log handlers, too.