in lib/src/grpc_api_impl/logging_impl.dart [161:230]
void _enqueue({bool finish = false, int? responseStatus, int? responseSize}) {
final api.Timestamp startTimestamp =
_protobufTimestampFromMilliseconds(_startTimestamp);
final int now = DateTime.now().toUtc().millisecondsSinceEpoch;
final api.Timestamp nowTimestamp = _protobufTimestampFromMilliseconds(now);
final protoPayload = api.Any()
..typeUrl = 'type.googleapis.com/google.appengine.logging.v1.RequestLog';
final gaeResource = api.MonitoredResource()
..type = 'gae_app'
..labels.addAll(_sharedLoggingService.resourceLabels);
final logEntry = api.LogEntry()
..protoPayload = protoPayload
..resource = gaeResource
..timestamp = nowTimestamp
..severity = _currentSeverity
..logName = _sharedLoggingService.requestLogName;
final appengineRequestLog = gae_log.RequestLog()
..appId = 's~${_sharedLoggingService.projectId}'
..versionId = _sharedLoggingService.versionId
..method = _httpMethod
..resource = _httpResource
..startTime = startTimestamp
..userAgent = _userAgent
..host = _host
..ip = _ip
..line.addAll(_gaeLogLines)
..first = _isFirst
..finished = finish;
if (_sharedLoggingService.instanceId != null) {
appengineRequestLog.instanceId = _sharedLoggingService.instanceId!;
}
if (_traceId != null) {
appengineRequestLog.traceId = _traceId!;
_addLabel(logEntry, 'appengine.googleapis.com/trace_id', _traceId!);
}
appengineRequestLog.referrer = _referrer;
_resetState();
if (finish) {
final int diff = now - _startTimestamp;
final latency = api.Duration()
..seconds = api.Int64(diff ~/ 1000)
..nanos = 1000 * 1000 * (diff % 1000);
appengineRequestLog
..endTime = nowTimestamp
..latency = latency
..status = responseStatus!;
if (responseSize != null) {
appengineRequestLog.responseSize = api.Int64(responseSize);
}
final httpRequest = api.HttpRequest()..status = responseStatus;
logEntry.httpRequest = httpRequest;
}
protoPayload.value = appengineRequestLog.writeToBuffer();
_sharedLoggingService.enqueue(logEntry);
}