MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / WriteStdLog

Method WriteStdLog

pkg/controller/rtctrl/logstore.go:219–256  ·  view source on GitHub ↗
(from int, buf []byte, eof bool)

Source from the content-addressed store, hash-verified

217}
218
219func (s *kunLogStatStore) WriteStdLog(from int, buf []byte, eof bool) (int, error) {
220 if s.flags.Has(flagClosed) {
221 return 0, errReceiverClosed
222 }
223
224 if eof {
225 if from == StdoutLog {
226 s.outLogDone()
227 } else if from == StderrLog {
228 s.errLogDone()
229 }
230 }
231 if len(buf) == 0 {
232 return 0, nil
233 }
234
235 s.appendLogbuf(buf, false)
236 logfile := s.logfile
237 if logfile == nil {
238 return len(buf), nil
239 }
240 l := &userlog.UserLog{
241 Created: time.Now(),
242 RequestID: s.requestID,
243 TriggerType: s.triggerType,
244 RuntimeID: s.runtimeID,
245 Source: logSource[from],
246 UserID: s.userID,
247 FuncName: s.funcName,
248 FunctionBrn: s.funcBrn,
249 Version: s.funcVersion,
250 InvocationTime: -1,
251 MemoryUsage: -1,
252 ResponseStatus: -1,
253 Mode: "",
254 }
255 return logfile.Write(l, buf)
256}
257
258func (s *kunLogStatStore) WriteFunctionLog(log string) error {
259 if s.flags.Has(flagClosed) {

Callers

nothing calls this directly

Calls 5

outLogDoneMethod · 0.95
errLogDoneMethod · 0.95
appendLogbufMethod · 0.95
WriteMethod · 0.65
HasMethod · 0.45

Tested by

no test coverage detected