refactor: use log for log
parent
c933613d1e
commit
ec9900e166
9
main.go
9
main.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -112,7 +111,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
h.c.Configured = true
|
h.c.Configured = true
|
||||||
|
|
||||||
// Print loaded config
|
// Print loaded config
|
||||||
fmt.Printf("%+v\n", h.c)
|
log.Printf("%+v\n", h.c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,12 +212,12 @@ func loadConfig(path string, c *Config) {
|
||||||
c.Configured = true
|
c.Configured = true
|
||||||
|
|
||||||
// Print loaded config
|
// Print loaded config
|
||||||
fmt.Printf("%+v\n", c)
|
log.Printf("%+v\n", c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) >= 2 && os.Args[1] == "test" {
|
if len(os.Args) >= 2 && os.Args[1] == "test" {
|
||||||
fmt.Println("test successful")
|
log.Println("test successful")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +258,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print config
|
// Print config
|
||||||
fmt.Printf("%+v\n", c)
|
log.Printf("%+v\n", c)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
log.Println("Starting VOD server")
|
log.Println("Starting VOD server")
|
||||||
|
|
|
@ -200,12 +200,12 @@ func (s *Stream) ServeFullVideo(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
||||||
cmdStdOut, err := coder.StdoutPipe()
|
cmdStdOut, err := coder.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
log.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdStdErr, err := coder.StderrPipe()
|
cmdStdErr, err := coder.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
log.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = coder.Start()
|
err = coder.Start()
|
||||||
|
@ -529,12 +529,12 @@ func (s *Stream) transcode(startId int) {
|
||||||
|
|
||||||
cmdStdOut, err := s.coder.StdoutPipe()
|
cmdStdOut, err := s.coder.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
log.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdStdErr, err := s.coder.StderrPipe()
|
cmdStdErr, err := s.coder.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
log.Printf("FATAL: ffmpeg command stdout failed with %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.coder.Start()
|
err = s.coder.Start()
|
||||||
|
|
Loading…
Reference in New Issue