feat: Enhance logging configuration with support for multiple log files and formats; improve CLI help output

This commit is contained in:
Илья Глазунов
2025-09-02 15:27:20 +03:00
parent 79c8f127ca
commit fb38853427
10 changed files with 584 additions and 72 deletions
+47 -3
View File
@@ -7,11 +7,55 @@ PACKAGE_NAME = pyserve
GREEN = \033[0;32m
YELLOW = \033[1;33m
RED = \033[0;31m
CYAN = \033[0;36m
NC = \033[0m
help:
@echo "$(GREEN)Commands:$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(YELLOW)%-20s$(NC) %s\n", $$1, $$2}'
@echo "$(GREEN)╔══════════════════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(GREEN)$(NC) $(GREEN)Available Commands:$(NC) $(GREEN)$(NC)"
@echo "$(GREEN)╠══════════════════════════════════════════════════════════════════════════════╣$(NC)"
@echo "$(YELLOW)Installation:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "install" "Installing dependencies"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "dev-install" "Installing development dependencies"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "dev-deps" "Installing additional tools"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "install-package" "Installing package locally"
@echo ""
@echo "$(YELLOW)Building:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "build" "Building package"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "clean" "Cleaning temporary files"
@echo ""
@echo "$(YELLOW)Testing:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "test" "Running tests"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "test-cov" "Running tests with coverage"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "lint" "Checking code with linters"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "format" "Formatting code"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "check" "Lint and test"
@echo ""
@echo "$(YELLOW)Running:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "run" "Starting server in development mode"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "run-prod" "Starting server in production mode"
@echo ""
@echo "$(YELLOW)Publishing:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "publish-test" "Publishing to Test PyPI"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "publish" "Publishing to PyPI"
@echo ""
@echo "$(YELLOW)Versioning:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "version" "Show current version"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "version-patch" "Increase patch version"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "version-minor" "Increase minor version"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "version-major" "Increase major version"
@echo ""
@echo "$(YELLOW)Environment:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "shell" "Opening Poetry shell"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "env-info" "Environment information"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "deps-update" "Updating dependencies"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "deps-show" "Dependency tree"
@echo ""
@echo "$(YELLOW)Configuration:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "config-create" "Creating config.yaml"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "watch-logs" "Last server logs"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "init" "Project initialized for development"
@echo "$(GREEN)╚══════════════════════════════════════════════════════════════════════════════╝$(NC)"
install:
@echo "$(GREEN)Installing dependencies...$(NC)"
@@ -118,7 +162,7 @@ config-create:
echo "$(YELLOW)config.yaml already exists$(NC)"; \
fi
logs:
watch-logs:
@echo "$(GREEN)Last server logs:$(NC)"
@if [ -f logs/pyserve.log ]; then tail -f logs/pyserve.log; else echo "$(RED)Log file not found$(NC)"; fi