refactor: make logger parameter optional
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
"""Safeguard module for Skywipe"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
from typing import Optional
|
||||
from .logger import get_logger
|
||||
|
||||
|
||||
CONFIRM_RESPONSES = {"yes", "y"}
|
||||
|
||||
|
||||
def require_confirmation(operation: str, skip_confirmation: bool = False) -> None:
|
||||
def require_confirmation(operation: str, skip_confirmation: bool = False, logger: Optional[logging.Logger] = None) -> None:
|
||||
if skip_confirmation:
|
||||
return
|
||||
|
||||
logger = get_logger()
|
||||
if logger is None:
|
||||
logger = get_logger()
|
||||
|
||||
logger.warning(f"This will {operation}")
|
||||
logger.warning("This operation is DESTRUCTIVE and cannot be undone!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user