improved log output
This commit is contained in:
parent
6531080a02
commit
996efe5421
1 changed files with 3 additions and 4 deletions
|
@ -30,7 +30,7 @@ func handleRequests(writer http.ResponseWriter, request *http.Request) {
|
|||
requestMethod := strings.ToLower(request.Method)
|
||||
user, authorized := isAuthorized(request)
|
||||
if !authorized {
|
||||
log.Debug("denying unauthorized '" + requestMethod + "' request for path '" + requestPath + "'")
|
||||
log.Info("denying unauthorized '"+requestMethod+"' request", "path: "+requestPath)
|
||||
writer.WriteHeader(404)
|
||||
writer.Write([]byte("error: basic authorization failed\n"))
|
||||
return
|
||||
|
@ -38,16 +38,15 @@ func handleRequests(writer http.ResponseWriter, request *http.Request) {
|
|||
handled := false
|
||||
switch requestMethod {
|
||||
case "get":
|
||||
log.Debug("handling '" + requestMethod + "' request for path '" + requestPath + "'...")
|
||||
handled = handleGet(user, writer, request)
|
||||
case "post":
|
||||
log.Debug("handling '" + requestMethod + "' request for path '" + requestPath + "'...")
|
||||
handled = handlePost(user, writer, request)
|
||||
}
|
||||
if handled {
|
||||
log.Debug("handled '"+requestMethod+"' request", "path: "+requestPath, "user: "+user)
|
||||
return
|
||||
}
|
||||
log.Debug("ignoring '" + requestMethod + "' request for path '" + requestPath + "'\n")
|
||||
log.Debug("ignoring '"+requestMethod+"' request", "path: "+requestPath, "user: "+user)
|
||||
writer.WriteHeader(501)
|
||||
writer.Write([]byte("error: endpoint '" + requestPath + "' not implemented\n"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue