diff --git a/hwmonDaemon.py b/hwmonDaemon.py index 1b5c08b..fe0354e 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -6,10 +6,10 @@ from typing import Dict, Any, List # LOGGING SETUP # ============================================================================= logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) +logger.setLevel(logging.INFO) console_handler = logging.StreamHandler() -console_handler.setLevel(logging.DEBUG) +console_handler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') console_handler.setFormatter(formatter) @@ -634,13 +634,21 @@ class SystemHealthMonitor: # ============================================================================= # INITIALIZATION # ============================================================================= - def __init__(self, ticket_api_url: str = 'http://10.10.10.45/create_ticket_api.php', dry_run: bool = False): + def __init__(self, ticket_api_url: str = 'http://10.10.10.45/create_ticket_api.php', dry_run: bool = False, verbose: bool = False): """ Initialize the system health monitor. :param ticket_api_url: URL for the ticket creation API. :param dry_run: If True, simulate API calls without sending requests. + :param verbose: If True, enable DEBUG-level logging output. """ + # Set log verbosity + if verbose: + logger.setLevel(logging.DEBUG) + for handler in logger.handlers: + handler.setLevel(logging.DEBUG) + logger.debug("Verbose logging enabled") + # Load environment configuration first (API keys, etc.) self.load_env_config() @@ -3538,11 +3546,17 @@ def main(): metavar="FILE", help="Export health report to JSON file." ) + parser.add_argument( + "-v", "--verbose", + action="store_true", + help="Enable verbose (DEBUG) logging output." + ) args = parser.parse_args() monitor = SystemHealthMonitor( ticket_api_url=SystemHealthMonitor.CONFIG['TICKET_API_URL'], - dry_run=args.dry_run + dry_run=args.dry_run, + verbose=args.verbose ) if args.metrics: