"""Create error_monitor
Generated by Phi-Octopus Eden
2025-11-07 04:03:17.406865
"""

```python
import logging


class ErrorMonitor:
    """
    A class for monitoring and handling errors in a controlled manner.
    
    Attributes:
        log_level (str): The logging level to use ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
        error_threshold (int): Number of consecutive errors before shutting down.
        recovery_actions (list): Actions to take when an error threshold is reached.

    Methods:
        __init__: Initialize the ErrorMonitor with specified log level and actions.
        monitor: Log an error message and check if the current number of errors exceeds the threshold.
                 If so, execute recovery actions and shut down.
    """
    
    def __init__(self, log_level='ERROR', error_threshold=5, recovery_actions=None):
        self.log = logging.getLogger(__name__)
        self.error_count = 0
        self.error_threshold = error_threshold
        self.recovery_actions = recovery_actions or []
        logging.basicConfig(level=log_level)

    def monitor(self, exception: Exception, message: str) -> None:
        """
        Log an error and increment the error count. Check if the threshold is exceeded.
        
        Args:
            exception (Exception): The exception that occurred.
            message (str): A descriptive message about the error.
            
        Raises:
            SystemExit: If the number of errors exceeds the threshold, indicating a critical issue.
        """
        self.log.error(message, exc_info=True)
        self.error_count += 1
        if self.error_count >= self.error_threshold:
            for action in self.recovery_actions:
                action()
            raise SystemExit("Error threshold exceeded. System is shutting down.")


# Example usage
def send_recovery_email():
    print("Sending recovery email...")

def restart_server():
    print("Restarting server...")

if __name__ == "__main__":
    recovery = [send_recovery_email, restart_server]
    
    try:
        raise ValueError("Example error")
    except Exception as e:
        monitor = ErrorMonitor(recovery_actions=recovery)
        monitor.monitor(e, "An example exception occurred.")
```