(from int, buf []byte, eof bool)
| 217 | } |
| 218 | |
| 219 | func (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 | |
| 258 | func (s *kunLogStatStore) WriteFunctionLog(log string) error { |
| 259 | if s.flags.Has(flagClosed) { |
nothing calls this directly
no test coverage detected