gohls
gohls copied to clipboard
persistent log
Hi shimberger:
maybe we can persistent log for later debuging. so I use gopkg.in/natefinch/lumberjack.v2
to persistent logfile, default is logs/server.log
and the log format change a bit
logformat before:
time="2020-12-07T16:01:22+08:00" level=info msg="Initializing HLS with directory '.gohls-data'"
time="2020-12-07T16:01:22+08:00" level=info msg="Starting index scan for filepath.MemIndex(d:\\videos)"
Path to ffmpeg executable: D:\Chrome\ffmpeg-4.2.3-win64-static\bin\ffmpeg.exe
Path to ffprobe executable: D:\Chrome\ffmpeg-4.2.3-win64-static\bin\ffprobe.exe
HLS data directory: .gohls-data/
Visit http://127.0.0.1:8080/
time="2020-12-07T16:01:22+08:00" level=info msg="Finished index scan for filepath.MemIndex(d:\\videos). Found 7 entries"
time="2020-12-07T16:01:23+08:00" level=warning msg="Error moving cache file into place: rename .gohls\\cache\\segments\\e9fa4f01c7f76999b2d5e80a182bcc9c1d85ec41.040692011 .gohls\\cache\\segments\\e9fa4f01c7f76999b2d5e80a182bcc9c1d85ec41: The process cannot access the file because it is being used by another process."
logformat now:
{"level":"info","msg":"Initializing HLS with directory '.gohls-data'","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Starting index scan for filepath.MemIndex(D:\\firefox)","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Path to ffmpeg executable: D:\\Chrome\\ffmpeg-4.2.3-win64-static\\bin\\ffmpeg.exe\n","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Path to ffprobe executable: D:\\Chrome\\ffmpeg-4.2.3-win64-static\\bin\\ffprobe.exe\n","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"HLS data directory: .gohls-data/\n","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Visit http://127.0.0.1:8080/\n","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Starting index scan for filepath.MemIndex(D:\\videos)","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Finished index scan for filepath.MemIndex(D:\\videos). Found 7 entries","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"info","msg":"Finished index scan for filepath.MemIndex(D:\\firefox). Found 39 entries","time":"2020-12-07 16:20:01.012 +0800 CST"}
{"level":"warning","msg":"Error moving cache file into place: rename .gohls\\cache\\segments\\9a28f72d24326cf307a22796b4948d5825fedb6d.588033891 .gohls\\cache\\segments\\9a28f72d24326cf307a22796b4948d5825fedb6d: The process cannot access the file because it is being used by another process.","time":"2020-12-07 16:20:02.012 +0800 CST"}
in internal/logger/logger.go
, we config the log setttings in init()
method, and in internal/cmd/serve.go
, we import _ "github.com/shimberger/gohls/internal/logger"
make init()
called, so in the whole project, when we use logrus
print info, the setting of logrus
will be applied