mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-03-17 21:17:53 +02:00
Panic on any logger errors
Any template errors instead of IO errors are caught in validation.
This commit is contained in:
parent
e88d29f16a
commit
a1358d2070
@ -137,15 +137,8 @@ func (l *Logger) Output(calldepth int, message string) {
|
||||
File: file,
|
||||
Message: message,
|
||||
})
|
||||
// Fallback for template errors
|
||||
if err != nil {
|
||||
_, ferr := fmt.Fprintf(l.writer, "[%s] [%s] %s",
|
||||
FormatTimestamp(now),
|
||||
file,
|
||||
message)
|
||||
if ferr != nil {
|
||||
panic(ferr)
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = l.writer.Write([]byte("\n"))
|
||||
@ -184,17 +177,8 @@ 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 {
|
||||
_, 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)
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, 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()),
|
||||
Username: username,
|
||||
})
|
||||
// Fallback for template errors
|
||||
if err != nil {
|
||||
_, 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)
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = l.writer.Write([]byte("\n"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user