]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve web服务日志
authorqydysky <qydysky@foxmail.com>
Tue, 31 Oct 2023 17:12:35 +0000 (01:12 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 31 Oct 2023 17:12:35 +0000 (01:12 +0800)
Reply/F.go

index c4c5e35cd43f742a57742da6c64544d84332033a..7b37d435feb11657483d98680fbeb2d41a6d1a97 100644 (file)
@@ -1482,7 +1482,10 @@ func init() {
                                        //      w.Header().Add(`Content-Range`, fmt.Sprintf("bytes %d-%d/%d", rangeHeaderNum, fi.Size()-1, fi.Size()))
                                        //      w.WriteHeader(http.StatusPartialContent)
 
-                                       flog.L(`T: `, r.RemoteAddr, `接入录播`+v)
+                                       flog.L(`T: `, r.RemoteAddr, `接入录播`)
+                                       ts := time.Now()
+                                       defer func() { flog.L(`T: `, r.RemoteAddr, `断开录播`, time.Since(ts)) }()
+
                                        if e := f.CopyToIoWriter(pweb.WithFlush(w), pio.CopyConfig{BytePerSec: speed}); e != nil {
                                                flog.L(`E: `, e)
                                        }
@@ -1513,11 +1516,11 @@ func init() {
                        // 推送数据
                        {
                                startFunc := func(_ *M4SStream) error {
-                                       flog.L(`T: `, r.RemoteAddr, `接入直播`)
+                                       flog.L(`T: `, r.RemoteAddr, `接入直播`)
                                        return nil
                                }
                                stopFunc := func(_ *M4SStream) error {
-                                       flog.L(`T: `, r.RemoteAddr, `断开直播`)
+                                       flog.L(`T: `, r.RemoteAddr, `断开直播`)
                                        return nil
                                }