fix(logging): use space-separated timestamps in unified log (1.2.12)
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 16s

Replace ISO T with YYYY-MM-DD HH:MM:SS so runtime log UI can wrap and display cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-15 14:09:25 +08:00
parent c9f5c37af8
commit 28abd3509a
4 changed files with 23 additions and 2 deletions

View File

@@ -45,6 +45,25 @@ class TestUnifiedLogging(unittest.TestCase):
self.assertFalse(any(isinstance(h, TimedRotatingFileHandler) for h in handlers))
self.assertTrue(any(isinstance(h, logging.NullHandler) for h in handlers))
def test_log_timestamp_uses_space_not_iso_t(self) -> None:
with tempfile.TemporaryDirectory() as tmp:
log_path = os.path.join(tmp, "skill.log")
logger_name = "test.logger.datefmt"
with patch.object(ul, "get_skill_log_file_path", return_value=log_path):
ul.setup_skill_logging("receive-order", logger_name)
ul.get_skill_logger().info("hello-datefmt")
ul._clear_logger_handlers(logging.getLogger(logger_name))
with open(log_path, encoding="utf-8") as f:
text = f.read()
self.assertRegex(
text,
r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \|",
)
self.assertNotRegex(
text,
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} \|",
)
def test_attach_unified_file_handler_unwritable(self) -> None:
logger_name = "test.logger.attach.unwritable"
with patch.object(ul, "_can_open_log_file", return_value=(False, "permission denied")):