完成日志输出到文件、终端多处的处理

This commit is contained in:
2024-11-13 16:11:59 +08:00
parent 9b643f4352
commit 28291598bb
28 changed files with 175 additions and 330 deletions

View File

@@ -3,7 +3,7 @@ package video
import (
"bufio"
"context"
"game-driver/pkg/logger"
"go.uber.org/zap"
"io"
"os/exec"
"sync"
@@ -11,7 +11,7 @@ import (
func Play(ctx context.Context, file string) error {
if file == "" {
logger.Infoln("video file is empty")
zap.S().Infoln("video file is empty")
return nil
}
cmd := exec.CommandContext(ctx, "ffplay", "-autoexit", "-fs", file)
@@ -40,7 +40,7 @@ func Play(ctx context.Context, file string) error {
}
break
}
logger.Infoln(string(line))
zap.S().Infoln(string(line))
}
}
}()