write method

Writes log entries to Logging.

This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resource names (projects, organizations, billing accounts or folders), where the resource name for a log entry is determined from its logName field.

request - The metadata request object.

Request parameters:

$fields - Selector specifying which fields to include in a partial response.

Completes with a WriteLogEntriesResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<WriteLogEntriesResponse> write(
  WriteLogEntriesRequest request, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v2/entries:write';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return WriteLogEntriesResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}