feat: Enhance logging configuration with support for multiple log files and formats; improve CLI help output
This commit is contained in:
+55
-11
@@ -18,29 +18,73 @@ ssl:
|
||||
logging:
|
||||
level: DEBUG
|
||||
console_output: true
|
||||
log_file: ./logs/pyserve.log
|
||||
format:
|
||||
type: standard
|
||||
use_colors: true
|
||||
show_module: true
|
||||
timestamp_format: "%Y-%m-%d %H:%M:%S"
|
||||
console:
|
||||
format:
|
||||
type: standard
|
||||
use_colors: true
|
||||
show_module: true
|
||||
level: DEBUG
|
||||
files:
|
||||
- path: "./logs/pyserve.log"
|
||||
level: DEBUG
|
||||
loggers: []
|
||||
format:
|
||||
type: standard
|
||||
use_colors: false
|
||||
show_module: true
|
||||
|
||||
- path: "./logs/pyserve.json"
|
||||
level: INFO
|
||||
loggers: []
|
||||
format:
|
||||
type: json
|
||||
use_colors: false
|
||||
show_module: true
|
||||
|
||||
- path: "./logs/server.log"
|
||||
level: DEBUG
|
||||
loggers: ["pyserve.server"]
|
||||
format:
|
||||
type: standard
|
||||
use_colors: false
|
||||
show_module: true
|
||||
|
||||
- path: "./logs/access.log"
|
||||
level: INFO
|
||||
loggers: ["pyserve.access"]
|
||||
max_bytes: 5242880 # 5MB
|
||||
backup_count: 10
|
||||
format:
|
||||
type: standard
|
||||
use_colors: false
|
||||
show_module: false
|
||||
|
||||
# НОВОЕ: Расширяемые модули
|
||||
# NEW: Extendable modules
|
||||
extensions:
|
||||
# Встроенное расширение для продвинутой маршрутизации
|
||||
# Built-in extension for advanced routing
|
||||
- type: routing
|
||||
config:
|
||||
regex_locations:
|
||||
# API маршруты с захватом версии
|
||||
# API routes with version capture
|
||||
"~^/api/v(?P<version>\\d+)/":
|
||||
proxy_pass: "http://localhost:9001"
|
||||
headers:
|
||||
- "API-Version: {version}"
|
||||
- "X-Forwarded-For: $remote_addr"
|
||||
|
||||
# Статические файлы с долгим кэшем
|
||||
|
||||
# Static files with long cache
|
||||
"~*\\.(js|css|png|jpg|gif|ico|svg|woff2?)$":
|
||||
root: "./static"
|
||||
cache_control: "public, max-age=31536000"
|
||||
headers:
|
||||
- "Access-Control-Allow-Origin: *"
|
||||
|
||||
# Exact match для health check
|
||||
|
||||
# Exact match for health check
|
||||
"=/health":
|
||||
return: "200 OK"
|
||||
content_type: "text/plain"
|
||||
@@ -48,13 +92,13 @@ extensions:
|
||||
"=/":
|
||||
root: "./static"
|
||||
index_file: "index.html"
|
||||
|
||||
# SPA fallback для всех остальных маршрутов
|
||||
|
||||
# SPA fallback for all other routes
|
||||
"__default__":
|
||||
spa_fallback: true
|
||||
root: "./static"
|
||||
index_file: "docs.html"
|
||||
# Исключения для SPA (не попадают в fallback)
|
||||
# Exceptions for SPA (do not hit fallback)
|
||||
exclude_patterns:
|
||||
- "/api/"
|
||||
- "/admin/"
|
||||
|
||||
Reference in New Issue
Block a user