mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-13 03:31:49 +08:00
fix(logger): 保留日志文件以便程序退出后调试并完善日志输出功能
This commit is contained in:
@@ -75,14 +75,20 @@ func TestLoggerCloseRemovesFileAndStopsWorker(t *testing.T) {
|
||||
logger.Info("before close")
|
||||
logger.Flush()
|
||||
|
||||
logPath := logger.Path()
|
||||
|
||||
if err := logger.Close(); err != nil {
|
||||
t.Fatalf("Close() returned error: %v", err)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(logger.Path()); !os.IsNotExist(err) {
|
||||
t.Fatalf("log file still exists after Close, err=%v", err)
|
||||
// After recent changes, log file is kept for debugging - NOT removed
|
||||
if _, err := os.Stat(logPath); os.IsNotExist(err) {
|
||||
t.Fatalf("log file should exist after Close for debugging, but got IsNotExist")
|
||||
}
|
||||
|
||||
// Clean up manually for test
|
||||
defer os.Remove(logPath)
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
logger.workerWG.Wait()
|
||||
|
||||
Reference in New Issue
Block a user