MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / formatLogMessage

Method formatLogMessage

pkg/logger/logger.go:134–158  ·  view source on GitHub ↗
(calldepth int, message string)

Source from the content-addressed store, hash-verified

132var std = New(LstdFlags)
133
134func (l *Logger) formatLogMessage(calldepth int, message string) []byte {
135 now := time.Now()
136 file := "???:0"
137
138 if l.flag&(Lshortfile|Llongfile) != 0 {
139 file = l.GetFileLineString(calldepth + 1)
140 }
141
142 var logBuff = new(bytes.Buffer)
143 err := l.stdLogTemplate.Execute(logBuff, stdLogMessageData{
144 Timestamp: FormatTimestamp(now),
145 File: file,
146 Message: message,
147 })
148 if err != nil {
149 panic(err)
150 }
151
152 _, err = logBuff.Write([]byte("\n"))
153 if err != nil {
154 panic(err)
155 }
156
157 return logBuff.Bytes()
158}
159
160// Output a standard log template with a simple message to default output channel.
161// Write a final newline at the end of every message.

Callers 1

OutputMethod · 0.95

Calls 3

GetFileLineStringMethod · 0.95
FormatTimestampFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected