Add verbosity control with -v/--verbose flag

Change default log level from DEBUG to INFO to reduce noise during
hourly execution. Add --verbose/-v CLI flag to enable DEBUG logging
when needed for troubleshooting.

Resolves #16

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 12:58:43 -05:00
parent 38dd120da2
commit da2de4375e

View File

@@ -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: