import click from loguru import logger import os from pathlib import Path # Configure logging to output to both file and stdout as specified in requirements def setup_logging(): # Create logs directory if it doesn't exist logs_dir = Path("logs") logs_dir.mkdir(exist_ok=True) # Add file logging with rotation logger.add("logs/dev.log", rotation="10 MB", retention="10 days") @click.group() def cli(): """Main CLI group""" setup_logging() pass @cli.command(name="ping", help="Ping command that outputs pong") def ping(): """Ping command that outputs pong""" logger.info("Ping command executed") click.echo("pong") if __name__ == "__main__": cli()