MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / RestLogs

Method RestLogs

module/service/iml.go:207–231  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, start int64, end int64, page int, size int)

Source from the content-addressed store, hash-verified

205}
206
207func (i *imlServiceModule) RestLogs(ctx context.Context, serviceId string, start int64, end int64, page int, size int) ([]*service_dto.RestLogItem, int64, error) {
208 list, total, err := i.logService.LogRecordsByService(ctx, serviceId, time.Unix(start, 0), time.Unix(end, 0), page, size)
209 if err != nil {
210 return nil, 0, err
211 }
212 return utils.SliceToSlice(list, func(s *log_service.Item) *service_dto.RestLogItem {
213 item := &service_dto.RestLogItem{
214 Id: s.ID,
215 API: auto.UUID(s.API),
216 Status: s.StatusCode,
217 LogTime: auto.TimeLabel(s.RecordTime),
218 Ip: s.RemoteIP,
219 Consumer: auto.UUID(s.Consumer),
220 ResponseTime: common.FormatTime(s.ResponseTime),
221 Traffic: common.FormatByte(s.Traffic),
222 }
223 if s.Consumer == "apipark-global" {
224 item.Consumer = auto.Label{
225 Id: s.Consumer,
226 Name: "System Consumer",
227 }
228 }
229 return item
230 }), total, nil
231}
232
233func (i *imlServiceModule) AILogs(ctx context.Context, serviceId string, start int64, end int64, page int, size int) ([]*service_dto.AILogItem, int64, error) {
234 list, total, err := i.logService.LogRecordsByService(ctx, serviceId, time.Unix(start, 0), time.Unix(end, 0), page, size)

Callers

nothing calls this directly

Calls 3

FormatTimeFunction · 0.92
FormatByteFunction · 0.92
LogRecordsByServiceMethod · 0.65

Tested by

no test coverage detected