import logging
import typing as t

# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')


def detect_emergence(data: t.List[float], threshold: float = 10.0) -> bool:
    """
    Detects emergent behavior in a given dataset.

    Args:
        data: A list of numerical data points.
        threshold: A threshold value. If any data point exceeds this threshold,
            emergent behavior is considered to be detected.

    Returns:
        True if emergent behavior is detected, False otherwise.
    """
    try:
        if not isinstance(data, list):
            raise TypeError("Data must be a list.")
        if not all(isinstance(x, (int, float)) for x in data):
            raise ValueError("Data list must contain only numbers.")
        if not isinstance(threshold, (int, float)):
            raise TypeError("Threshold must be a number.")

        for value in data:
            if value > threshold:
                logging.info(f"Emergence detected: Value {value} exceeds threshold {threshold}")
                return True
        logging.info("No emergence detected.")
        return False

    except TypeError as e:
        logging.error(f"Type error: {e}")
        return False
    except ValueError as e:
        logging.error(f"Value error: {e}")
        return False
    except Exception as e:
        logging.error(f"An unexpected error occurred: {e}")
        return False


if __name__ == '__main__':
    # Example usage
    data1 = [1.0, 2.0, 11.0, 4.0, 5.0]
    data2 = [1.0, 2.0, 3.0, 4.0, 5.0]

    print(f"Emergence in data1: {detect_emergence(data1)}")
    print(f"Emergence in data2: {detect_emergence(data2)}")