From 41717db99c80a461098db83b8f8191a3dfe5cd19 Mon Sep 17 00:00:00 2001 From: milarin Date: Sat, 25 Feb 2023 12:13:04 +0100 Subject: [PATCH] logging --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 46d0a23..4fe1950 100644 --- a/main.go +++ b/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)