Files
douyi_guaji_main/tools/tmp_check_logging.py
T

38 lines
1.2 KiB
Python

from douyin.logging import douyin_logging
import logging
import logging.handlers as lh
# Configure logging using current config
douyin_logging.configure_logging()
root = logging.getLogger()
print("handlers:", [type(h).__name__ for h in root.handlers])
for h in root.handlers:
fname = getattr(h, "baseFilename", getattr(h, "filename", None))
print(type(h).__name__, fname)
# RotatingDatedFileHandler specific
if hasattr(h, "max_bytes"):
print(
" max_bytes =",
getattr(h, "max_bytes", None),
"backup_count =",
getattr(h, "backup_count", None),
)
# RotatingFileHandler
if isinstance(h, lh.RotatingFileHandler):
print(
" RotatingFileHandler maxBytes =",
getattr(h, "maxBytes", None),
"backupCount =",
getattr(h, "backupCount", None),
)
if isinstance(h, lh.TimedRotatingFileHandler):
print(
" TimedRotating when =",
getattr(h, "when", None),
"interval =",
getattr(h, "interval", None),
"backupCount =",
getattr(h, "backupCount", None),
)