added proper logging to most of the code

This commit is contained in:
watn3y 2023-09-07 03:24:31 +02:00
parent 65c6020e49
commit 7d4c9c5ab9
21 changed files with 218 additions and 283 deletions

View file

@ -1,7 +1,7 @@
package webserver
import (
"log"
"github.com/rs/zerolog/log"
"net/http"
)
@ -9,9 +9,12 @@ func RunWeb() {
fs := http.FileServer(http.Dir("./videos"))
http.Handle("/", fs)
log.Print("Listening on :3556...")
log.Info().Str("port", "3556").Str("path", "./videos").Msg("Starting webserver")
err := http.ListenAndServe(":3556", nil)
if err != nil {
log.Fatal(err)
log.Panic().Err(err).Msg("Failed to start webserver")
}
}