You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-21 00:29:44 +02:00
Panic on any logger errors
Any template errors instead of IO errors are caught in validation.
This commit is contained in:
@ -137,15 +137,8 @@ func (l *Logger) Output(calldepth int, message string) {
|
|||||||
File: file,
|
File: file,
|
||||||
Message: message,
|
Message: message,
|
||||||
})
|
})
|
||||||
// Fallback for template errors
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, ferr := fmt.Fprintf(l.writer, "[%s] [%s] %s",
|
panic(err)
|
||||||
FormatTimestamp(now),
|
|
||||||
file,
|
|
||||||
message)
|
|
||||||
if ferr != nil {
|
|
||||||
panic(ferr)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = l.writer.Write([]byte("\n"))
|
_, err = l.writer.Write([]byte("\n"))
|
||||||
@ -184,17 +177,8 @@ func (l *Logger) PrintAuthf(username string, req *http.Request, status AuthStatu
|
|||||||
Status: string(status),
|
Status: string(status),
|
||||||
Message: fmt.Sprintf(format, a...),
|
Message: fmt.Sprintf(format, a...),
|
||||||
})
|
})
|
||||||
// Fallback for template errors
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, ferr := fmt.Fprintf(l.writer, "%s - %s [%s] [%s] %s",
|
panic(err)
|
||||||
client,
|
|
||||||
username,
|
|
||||||
FormatTimestamp(now),
|
|
||||||
string(status),
|
|
||||||
fmt.Sprintf(format, a...))
|
|
||||||
if ferr != nil {
|
|
||||||
panic(ferr)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = l.writer.Write([]byte("\n"))
|
_, err = l.writer.Write([]byte("\n"))
|
||||||
@ -250,14 +234,8 @@ func (l *Logger) PrintReq(username, upstream string, req *http.Request, url url.
|
|||||||
UserAgent: fmt.Sprintf("%q", req.UserAgent()),
|
UserAgent: fmt.Sprintf("%q", req.UserAgent()),
|
||||||
Username: username,
|
Username: username,
|
||||||
})
|
})
|
||||||
// Fallback for template errors
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_, ferr := fmt.Fprintf(l.writer, "%s - %s [%s] %s %s %s %q %s %q %d %d %0.3f",
|
panic(err)
|
||||||
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"))
|
_, err = l.writer.Write([]byte("\n"))
|
||||||
|
Reference in New Issue
Block a user