Lewati ke konten utama

File Logging

File Logging

Active

Simpan detailed records dalam size-limited rotating file.

Command[tool.custy.logging.file]

Category

Logging Configuration

Quick Command

[tool.custy.logging.file]

DEBUG filerotationretention

Properties

Properties

PropertyTypeDescriptionDefaultRequired
levelDEBUG | INFO | WARNING | ERROR | CRITICALThreshold untuk persistent records.DEBUGNo
log_dirDirectory pathDirectory yang dibuat saat logging diinisialisasi.logsNo
log_fileFilenameActive log filename di dalam log_dir.custy.logNo
max_bytesSize stringMaximum active-file size sebelum rotation. Parser menerima size units seperti KB, MB, dan GB.10MBNo
backup_countIntegerMaximum number of rotated files yang dipertahankan.5No
file_formatLogging formatPersistent Python logging format. Formatter Custy menghapus Rich markup.%(asctime)s | %(levelname)s | %(name)s | %(message)sNo
Generated file logging
toml
[tool.custy.logging.file]
level = "DEBUG"
log_dir = "logs"
log_file = "custy.log"
max_bytes = "10MB"
backup_count = 5
file_format = "%(asctime)s | %(levelname)s | %(name)s | %(message)s"

Contoh Rotation

Dengan generated values, custy.log dirotasi setelah sekitar 10 MB dan mempertahankan hingga lima numbered historical files selain active log.

Lanjutkan