summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst92@gmail.com>2021-08-10 16:20:10 +0200
committerJulian Hurst <julian.hurst92@gmail.com>2021-08-10 16:20:10 +0200
commitcbd9317993b188ef142aad11b64a235206369aa0 (patch)
treef28198e7771e4bfcfec2f2523d929a91fd027637
parentae9cc2ac49b976992f2e924ef8d30bd540ce2ec0 (diff)
downloadgrimtube-cbd9317993b188ef142aad11b64a235206369aa0.tar.gz
Add debug flag to activate debug/additional logsHEADmaster
-rw-r--r--grimtube.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/grimtube.go b/grimtube.go
index 385be92..9f8061b 100644
--- a/grimtube.go
+++ b/grimtube.go
@@ -15,6 +15,7 @@ import (
var docPath string
var dlsrv string
+var debug bool
func getLangs() []string {
return []string{"en", "fr", "de", "ja", "ru"}
@@ -102,7 +103,9 @@ func search(w http.ResponseWriter, r *http.Request) {
page = p
}
}
- log.Printf("searching: %s, page: %d, lang: %s, order: %s\n", term, page, lang, order)
+ if debug {
+ log.Printf("searching: %s, page: %d, lang: %s, order: %s\n", term, page, lang, order)
+ }
items, err := ytparser.Search(term, page, lang, order)
if err != nil {
log.Println(err)
@@ -166,9 +169,11 @@ func main() {
port := flag.Int("p", 8080, "The port to bind to.")
dir := flag.String("d", "", "Location of the templates and static resources.")
dl := flag.String("dlsrv", "", "Link to a download server.")
+ debugFlag := flag.Bool("debug", false, "Activate debug logs")
flag.Parse()
docPath = *dir
dlsrv = *dl
+ debug = *debugFlag
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix(path.Join(docPath, "/static/"), fs))
http.HandleFunc("/favicon.ico", favicon)