"""Create error_monitor
Generated by Phi-Octopus Eden
2025-11-08 16:05:44.640396
"""

```python
import logging
from typing import Any, Callable, Dict, Tuple


def create_error_monitor(
    function: Callable,
    max_retries: int = 3,
    retry_delay: float = 1.0,
) -> Tuple[Callable, Dict[str, Any]]:
    """
    Creates an error monitoring wrapper for a given function.

    Args:
        function (Callable): The function to be wrapped.
        max_retries (int): Maximum number of retries before giving up. Default is 3.
        retry_delay (float): Delay between retries in seconds. Default is 1.0.

    Returns:
        Tuple[Callable, Dict[str, Any]]: A tuple containing the wrapped function and its metadata.
    """
    error_logger = logging.getLogger('error_monitor')
    error_logger.setLevel(logging.ERROR)

    handler = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    handler.setFormatter(formatter)
    error_logger.addHandler(handler)

    def wrapped_function(*args, **kwargs) -> Any:
        nonlocal max_retries
        retries_left = max_retries

        while retries_left > 0:
            try:
                result = function(*args, **kwargs)
                return result
            except Exception as e:
                error_logger.error(f"An error occurred: {e}")
                retries_left -= 1
                if retries_left == 0:
                    raise

    metadata = {
        'max_retries': max_retries,
        'retry_delay': retry_delay
    }

    return wrapped_function, metadata


# Example usage:
def example_function():
    import random
    if random.random() < 0.5:
        raise ValueError("Example error")
    else:
        print("Function executed successfully")


wrapped_func, meta = create_error_monitor(example_function)
try:
    result = wrapped_func()
    print(result)
except Exception as e:
    print(f"Final error: {e}")
```