mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-04-13 11:50:45 +02:00
Attempt to log still on template errors
This commit is contained in:
parent
542bf1fad1
commit
45222395e0
@ -647,7 +647,7 @@ func (p *OAuthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
func (p *OAuthProxy) SignIn(rw http.ResponseWriter, req *http.Request) {
|
||||
redirect, err := p.GetRedirect(req)
|
||||
if err != nil {
|
||||
logger.Printf("Error obtaining redirect: %s", err.Error())
|
||||
logger.Printf("Error obtaining redirect: %v", err)
|
||||
p.ErrorPage(rw, http.StatusInternalServerError, "Internal Server Error", err.Error())
|
||||
return
|
||||
}
|
||||
@ -657,7 +657,7 @@ func (p *OAuthProxy) SignIn(rw http.ResponseWriter, req *http.Request) {
|
||||
session := &sessionsapi.SessionState{User: user}
|
||||
err = p.SaveSession(rw, req, session)
|
||||
if err != nil {
|
||||
logger.Printf("Error saving session: %s", err.Error())
|
||||
logger.Printf("Error saving session: %v", err)
|
||||
p.ErrorPage(rw, http.StatusInternalServerError, "Internal Server Error", err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -137,8 +137,15 @@ func (l *Logger) Output(calldepth int, message string) {
|
||||
File: file,
|
||||
Message: message,
|
||||
})
|
||||
// Fallback for template errors
|
||||
if err != nil {
|
||||
panic(err)
|
||||
_, ferr := fmt.Fprintf(l.writer, "[%s] [%s] %s",
|
||||
FormatTimestamp(now),
|
||||
file,
|
||||
message)
|
||||
if ferr != nil {
|
||||
panic(ferr)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = l.writer.Write([]byte("\n"))
|
||||
@ -177,8 +184,17 @@ func (l *Logger) PrintAuthf(username string, req *http.Request, status AuthStatu
|
||||
Status: string(status),
|
||||
Message: fmt.Sprintf(format, a...),
|
||||
})
|
||||
// Fallback for template errors
|
||||
if err != nil {
|
||||
panic(err)
|
||||
_, ferr := fmt.Fprintf(l.writer, "%s - %s [%s] [%s] %s",
|
||||
client,
|
||||
username,
|
||||
FormatTimestamp(now),
|
||||
string(status),
|
||||
fmt.Sprintf(format, a...))
|
||||
if ferr != nil {
|
||||
panic(ferr)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = l.writer.Write([]byte("\n"))
|
||||
@ -234,8 +250,14 @@ func (l *Logger) PrintReq(username, upstream string, req *http.Request, url url.
|
||||
UserAgent: fmt.Sprintf("%q", req.UserAgent()),
|
||||
Username: username,
|
||||
})
|
||||
// Fallback for template errors
|
||||
if err != nil {
|
||||
panic(err)
|
||||
_, ferr := fmt.Fprintf(l.writer, "%s - %s [%s] %s %s %s %q %s %q %d %d %0.3f",
|
||||
client, username, FormatTimestamp(ts), req.Host, req.Method, upstream,
|
||||
url.RequestURI(), req.Proto, req.UserAgent(), status, size, duration)
|
||||
if ferr != nil {
|
||||
panic(ferr)
|
||||
}
|
||||
}
|
||||
|
||||
_, err = l.writer.Write([]byte("\n"))
|
||||
|
@ -49,12 +49,7 @@ func (m *Manager) Save(rw http.ResponseWriter, req *http.Request, s *sessions.Se
|
||||
return err
|
||||
}
|
||||
|
||||
err = tckt.setCookie(rw, req, s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return tckt.setCookie(rw, req, s)
|
||||
}
|
||||
|
||||
// Load reads sessions.SessionState information from a session store. It will
|
||||
|
Loading…
x
Reference in New Issue
Block a user