refactor(logging): 统一字符串引号风格,优化日志处理输出格式
This commit is contained in:
1 parent
3d93f7f723
commit
768f04c5d5
3 files changed
+143
-65
No files matched your search
@@ -5,16 +5,33 @@ 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])
|
||||
print("handlers:", [type(h).__name__ for h in root.handlers])
|
||||
|
||||
for h in root.handlers:
|
||||
fname = getattr(h, 'baseFilename', getattr(h, 'filename', None))
|
||||
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))
|
||||
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))
|
||||
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))
|
||||
print(
|
||||
" TimedRotating when =",
|
||||
getattr(h, "when", None),
|
||||
"interval =",
|
||||
getattr(h, "interval", None),
|
||||
"backupCount =",
|
||||
getattr(h, "backupCount", None),
|
||||
)
|
||||
Reference in new issue
Block a user