test
This commit is contained in:
@@ -1,21 +1,33 @@
|
||||
"""Re-export unified logging (implementation: jiangchang_skill_core.unified_logging)."""
|
||||
"""日志:直接用 stdlib logging(真实模板用 jiangchang_skill_core.unified_logging)。
|
||||
|
||||
from jiangchang_skill_core.unified_logging import (
|
||||
attach_unified_file_handler,
|
||||
ensure_trace_for_process,
|
||||
get_skill_log_file_path,
|
||||
get_skill_logger,
|
||||
get_unified_logs_dir,
|
||||
setup_skill_logging,
|
||||
subprocess_env_with_trace,
|
||||
)
|
||||
为保持与模板 ``from util.logging_config import get_skill_logger, setup_skill_logging``
|
||||
一致的调用面,本 demo 提供同名薄封装。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = [
|
||||
"attach_unified_file_handler",
|
||||
"ensure_trace_for_process",
|
||||
"get_skill_log_file_path",
|
||||
"get_skill_logger",
|
||||
"get_unified_logs_dir",
|
||||
"setup_skill_logging",
|
||||
"subprocess_env_with_trace",
|
||||
]
|
||||
import logging
|
||||
|
||||
import jiangchang_skill_core.unified_logging as unified_logging
|
||||
|
||||
from util.constants import LOG_LOGGER_NAME
|
||||
|
||||
_configured = False
|
||||
|
||||
|
||||
def setup_skill_logging(skill_slug: str, logger_name: str) -> None:
|
||||
# global _configured
|
||||
# if _configured:
|
||||
# return
|
||||
# handler = logging.StreamHandler()
|
||||
# handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s"))
|
||||
# logger = logging.getLogger(logger_name)
|
||||
# logger.setLevel(logging.INFO)
|
||||
# if not logger.handlers:
|
||||
# logger.addHandler(handler)
|
||||
# _configured = True
|
||||
unified_logging.setup_skill_logging(skill_slug, logger_name)
|
||||
|
||||
|
||||
def get_skill_logger() -> logging.Logger:
|
||||
#return logging.getLogger(LOG_LOGGER_NAME)
|
||||
return unified_logging.get_skill_logger()
|
||||
|
||||
Reference in New Issue
Block a user