logging
This commit is contained in:
parent
4d68f10de1
commit
41717db99c
5
main.go
5
main.go
@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -39,7 +40,7 @@ func main() {
|
||||
r.HandleFunc("/file/{file}/format/{format}/", GetEncodeFileHandler).Methods("GET")
|
||||
r.HandleFunc("/file/", GetAllFilesHandler).Methods("GET")
|
||||
|
||||
fmt.Printf("Starting music server on port %d\n", HttpPort)
|
||||
log.Printf("Starting music server on port %d\n", HttpPort)
|
||||
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", HttpIntf, HttpPort), r); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -191,7 +192,7 @@ func GetEncodeFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
outputFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%d.%s", rand.Int(), format))
|
||||
defer os.Remove(outputFilePath)
|
||||
|
||||
fmt.Printf("encode file to %s: '%s' -> '%s'\n", format, inputFilePath, outputFilePath)
|
||||
log.Printf("encode file to %s: '%s' -> '%s'\n", format, inputFilePath, outputFilePath)
|
||||
|
||||
if err := EncodeVideo2Mp3(inputFilePath, outputFilePath); err != nil {
|
||||
InternalServerError(w, err)
|
||||
|
Loading…
Reference in New Issue
Block a user