remove some logs

This commit is contained in:
TaiAurori 2022-06-25 11:25:08 -04:00
parent 8ff55a4174
commit c266a5d9fd
3 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"log"
"net/http" "net/http"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -30,7 +29,7 @@ func authenticateEndpoint(w http.ResponseWriter, r *http.Request) {
// checks username and password // checks username and password
authToken, err := getAuthToken(authPayload.Username, authPayload.Password) authToken, err := getAuthToken(authPayload.Username, authPayload.Password)
log.Println(err)
if err != nil { if err != nil {
err := YggError{ err := YggError{
Code: 403, Code: 403,

View File

@ -3,7 +3,6 @@ package main
import ( import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"log"
"net/http" "net/http"
"os" "os"
"strings" "strings"
@ -61,7 +60,6 @@ func hasJoinedEndpoint(w http.ResponseWriter, r *http.Request) {
handleError(w, err) handleError(w, err)
return return
} }
log.Println(response)
sendJSON(w, response) sendJSON(w, response)
} }

View File

@ -15,7 +15,9 @@ func sendJSON(w http.ResponseWriter, jsonMessage interface{}) {
} }
func sendError(w http.ResponseWriter, err YggError) { func sendError(w http.ResponseWriter, err YggError) {
log.Printf("Send error: %s\n", err.ErrorMessage) if config.DebugMode {
log.Printf("Send error: %s\n", err.ErrorMessage)
}
w.WriteHeader(err.Code) w.WriteHeader(err.Code)
sendJSON(w, err) sendJSON(w, err)
} }
@ -34,7 +36,7 @@ func unmarshalTo(r *http.Request, v any) error {
func handleError(w http.ResponseWriter, err error) { func handleError(w http.ResponseWriter, err error) {
sendError(w, YggError{Code: 500, Error: "Unspecified error", ErrorMessage: "An error has occured handling your request."}) sendError(w, YggError{Code: 500, Error: "Unspecified error", ErrorMessage: "An error has occured handling your request."})
log.Println("error processing:", err) log.Println("error processing request:", err)
if config.DebugMode { if config.DebugMode {
debug.PrintStack() debug.PrintStack()
} }