1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-30 18:29:16 +02:00

Ensure that calls to standard logger log.Println also output JSON

This commit is contained in:
binwiederhier 2023-02-17 20:52:48 -05:00
parent 38e7801b41
commit 9ff3bb0c87
5 changed files with 107 additions and 25 deletions
server

View file

@ -333,9 +333,9 @@ func (s *Server) handleError(w http.ResponseWriter, r *http.Request, v *visitor,
return
}
if isNormalError {
logvr(v, r).Err(httpErr).Debug("Connection closed with HTTP %d (ntfy error %d)", httpErr.HTTPCode, httpErr.Code)
logvr(v, r).Err(err).Debug("Connection closed with HTTP %d (ntfy error %d)", httpErr.HTTPCode, httpErr.Code)
} else {
logvr(v, r).Err(httpErr).Info("Connection closed with HTTP %d (ntfy error %d)", httpErr.HTTPCode, httpErr.Code)
logvr(v, r).Err(err).Info("Connection closed with HTTP %d (ntfy error %d)", httpErr.HTTPCode, httpErr.Code)
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", s.config.AccessControlAllowOrigin) // CORS, allow cross-origin requests