forked from Shifty/pyserveX
132 lines
3.5 KiB
YAML
132 lines
3.5 KiB
YAML
# Example extended logging configuration for PyServe
|
|
# Support for multiple files and logger-based separation
|
|
|
|
logging:
|
|
# Main logging level (applies by default)
|
|
level: DEBUG # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
|
|
|
# Enable/disable console output
|
|
console_output: true
|
|
|
|
# Global formatting settings (applied to console and files unless overridden)
|
|
format:
|
|
type: standard # standard or json
|
|
use_colors: true # Use colors (recommended false for files)
|
|
show_module: true # Show module name
|
|
timestamp_format: "%Y-%m-%d %H:%M:%S" # Timestamp format
|
|
|
|
# Specific settings for console output
|
|
console:
|
|
level: INFO # You can specify a separate level for the console
|
|
format:
|
|
type: standard # standard or json
|
|
use_colors: true # Colors in the console are usually helpful
|
|
show_module: true
|
|
timestamp_format: "%H:%M:%S" # Short timestamp format for console
|
|
|
|
# Logging file settings (you can specify multiple files)
|
|
files:
|
|
# Main log file - all logs
|
|
- path: "./logs/pyserve.log"
|
|
level: DEBUG
|
|
loggers: [] # Empty list means all loggers
|
|
max_bytes: 10485760 # 10MB (default)
|
|
backup_count: 5 # Number of backup files (default)
|
|
format:
|
|
type: standard
|
|
use_colors: false
|
|
show_module: true
|
|
|
|
# JSON log for automated analysis
|
|
- path: "./logs/pyserve.json"
|
|
level: INFO
|
|
loggers: []
|
|
format:
|
|
type: json
|
|
use_colors: false
|
|
show_module: true
|
|
|
|
# Separate file for server logs
|
|
- path: "./logs/server.log"
|
|
level: DEBUG
|
|
loggers: ["pyserve.server"] # Only logs from pyserve.server
|
|
format:
|
|
type: standard
|
|
use_colors: false
|
|
show_module: true
|
|
|
|
# Separate file for access logs
|
|
- path: "./logs/access.log"
|
|
level: INFO
|
|
loggers: ["pyserve.access"] # Only access logs
|
|
max_bytes: 5242880 # 5MB
|
|
backup_count: 10
|
|
format:
|
|
type: standard
|
|
use_colors: false
|
|
show_module: false # For access logs module is not needed
|
|
|
|
# Separate file for error logs
|
|
- path: "./logs/errors.log"
|
|
level: ERROR
|
|
loggers: [] # All errors from all loggers
|
|
format:
|
|
type: json # JSON for easy error parsing
|
|
use_colors: false
|
|
show_module: true
|
|
|
|
# Examples of various configurations:
|
|
|
|
# 1. Minimal configuration (backward compatibility):
|
|
# logging:
|
|
# level: INFO
|
|
# console_output: true
|
|
# files:
|
|
# - path: "./logs/pyserve.log"
|
|
# level: INFO
|
|
# loggers: []
|
|
|
|
# 2. Only JSON logs:
|
|
# logging:
|
|
# level: INFO
|
|
# console_output: false
|
|
# files:
|
|
# - path: "./logs/pyserve.json"
|
|
# format:
|
|
# type: json
|
|
|
|
# 3. Separation by log type:
|
|
# logging:
|
|
# level: DEBUG
|
|
# console_output: true
|
|
# files:
|
|
# - path: "./logs/general.log"
|
|
# level: INFO
|
|
# loggers: []
|
|
# - path: "./logs/server.log"
|
|
# level: DEBUG
|
|
# loggers: ["pyserve.server", "pyserve.routing"]
|
|
# - path: "./logs/access.log"
|
|
# level: INFO
|
|
# loggers: ["pyserve.access"]
|
|
# - path: "./logs/errors.json"
|
|
# level: ERROR
|
|
# loggers: []
|
|
# format:
|
|
# type: json
|
|
|
|
# 4. Console without colors, different formats for files:
|
|
# logging:
|
|
# level: DEBUG
|
|
# console_output: true
|
|
# console:
|
|
# format:
|
|
# use_colors: false
|
|
# files:
|
|
# - path: "./logs/standard.log"
|
|
# format:
|
|
# type: standard
|
|
# - path: "./logs/structured.json"
|
|
# format:
|
|
# type: json
|