forked from TripwireTeam/tripwire
remove some logs
This commit is contained in:
parent
8ff55a4174
commit
c266a5d9fd
3 changed files with 5 additions and 6 deletions
3
auth.go
3
auth.go
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
@ -30,7 +29,7 @@ func authenticateEndpoint(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// checks username and password
|
||||
authToken, err := getAuthToken(authPayload.Username, authPayload.Password)
|
||||
log.Println(err)
|
||||
|
||||
if err != nil {
|
||||
err := YggError{
|
||||
Code: 403,
|
||||
|
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -61,7 +60,6 @@ func hasJoinedEndpoint(w http.ResponseWriter, r *http.Request) {
|
|||
handleError(w, err)
|
||||
return
|
||||
}
|
||||
log.Println(response)
|
||||
|
||||
sendJSON(w, response)
|
||||
}
|
||||
|
|
4
util.go
4
util.go
|
@ -15,7 +15,9 @@ func sendJSON(w http.ResponseWriter, jsonMessage interface{}) {
|
|||
}
|
||||
|
||||
func sendError(w http.ResponseWriter, err YggError) {
|
||||
if config.DebugMode {
|
||||
log.Printf("Send error: %s\n", err.ErrorMessage)
|
||||
}
|
||||
w.WriteHeader(err.Code)
|
||||
sendJSON(w, err)
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ func unmarshalTo(r *http.Request, v any) error {
|
|||
|
||||
func handleError(w http.ResponseWriter, err error) {
|
||||
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 {
|
||||
debug.PrintStack()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue