1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-21 00:29:44 +02:00

Set up klog to write to our custom logger

This commit is contained in:
Joel Speed
2021-03-28 21:11:34 +01:00
parent fd5e23e1c5
commit 95464ca58f
5 changed files with 71 additions and 3 deletions

View File

@ -149,9 +149,12 @@ func (l *Logger) formatLogMessage(calldepth int, message string) []byte {
panic(err)
}
_, err = logBuff.Write([]byte("\n"))
if err != nil {
panic(err)
// If the output doesn't end with a new line, add one
if string(logBuff.Bytes()[logBuff.Len()-1]) != "\n" {
_, err = logBuff.Write([]byte("\n"))
if err != nil {
panic(err)
}
}
return logBuff.Bytes()