public abstract class LoggingServiceV2Client
Reference documentation and code samples for the Google Cloud Logging v2 API class LoggingServiceV2Client.
LoggingServiceV2 client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Logging.V2Assembly
Google.Cloud.Logging.V2.dll
Remarks
Service for ingesting and querying logs.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the LoggingServiceV2 service, which is a host of "logging.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default LoggingServiceV2 scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default LoggingServiceV2 scopes are:
GrpcClient
public virtual LoggingServiceV2.LoggingServiceV2Client GrpcClient { get; }
The underlying gRPC LoggingServiceV2 client
Property Value | |
---|---|
Type | Description |
LoggingServiceV2LoggingServiceV2Client |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static LoggingServiceV2Client Create()
Synchronously creates a LoggingServiceV2Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LoggingServiceV2ClientBuilder.
Returns | |
---|---|
Type | Description |
LoggingServiceV2Client | The created LoggingServiceV2Client. |
CreateAsync(CancellationToken)
public static Task<LoggingServiceV2Client> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a LoggingServiceV2Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LoggingServiceV2ClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskLoggingServiceV2Client | The task representing the created LoggingServiceV2Client. |
DeleteLog(DeleteLogRequest, CallSettings)
public virtual void DeleteLog(DeleteLogRequest request, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
request | DeleteLogRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
DeleteLogRequest request = new DeleteLogRequest
{
LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"),
};
// Make the request
loggingServiceV2Client.DeleteLog(request);
DeleteLog(LogName, CallSettings)
public virtual void DeleteLog(LogName logName, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | LogName Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
LogName logName = LogName.FromProjectLog("[PROJECT]", "[LOG]");
// Make the request
loggingServiceV2Client.DeleteLog(logName);
DeleteLog(string, CallSettings)
public virtual void DeleteLog(string logName, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | string Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
string logName = "projects/[PROJECT]/logs/[LOG]";
// Make the request
loggingServiceV2Client.DeleteLog(logName);
DeleteLogAsync(DeleteLogRequest, CallSettings)
public virtual Task DeleteLogAsync(DeleteLogRequest request, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
request | DeleteLogRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogRequest request = new DeleteLogRequest
{
LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"),
};
// Make the request
await loggingServiceV2Client.DeleteLogAsync(request);
DeleteLogAsync(DeleteLogRequest, CancellationToken)
public virtual Task DeleteLogAsync(DeleteLogRequest request, CancellationToken cancellationToken)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
request | DeleteLogRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogRequest request = new DeleteLogRequest
{
LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"),
};
// Make the request
await loggingServiceV2Client.DeleteLogAsync(request);
DeleteLogAsync(LogName, CallSettings)
public virtual Task DeleteLogAsync(LogName logName, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | LogName Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogName logName = LogName.FromProjectLog("[PROJECT]", "[LOG]");
// Make the request
await loggingServiceV2Client.DeleteLogAsync(logName);
DeleteLogAsync(LogName, CancellationToken)
public virtual Task DeleteLogAsync(LogName logName, CancellationToken cancellationToken)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | LogName Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogName logName = LogName.FromProjectLog("[PROJECT]", "[LOG]");
// Make the request
await loggingServiceV2Client.DeleteLogAsync(logName);
DeleteLogAsync(string, CallSettings)
public virtual Task DeleteLogAsync(string logName, CallSettings callSettings = null)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | string Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
string logName = "projects/[PROJECT]/logs/[LOG]";
// Make the request
await loggingServiceV2Client.DeleteLogAsync(logName);
DeleteLogAsync(string, CancellationToken)
public virtual Task DeleteLogAsync(string logName, CancellationToken cancellationToken)
Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
logName | string Required. The resource name of the log to delete:
For more information about log names, see [LogEntry][google.logging.v2.LogEntry]. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
string logName = "projects/[PROJECT]/logs/[LOG]";
// Make the request
await loggingServiceV2Client.DeleteLogAsync(logName);
ListLogEntries(ListLogEntriesRequest, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(ListLogEntriesRequest request, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
request | ListLogEntriesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
ListLogEntriesRequest request = new ListLogEntriesRequest
{
Filter = "",
OrderBy = "",
ResourceNamesAsProjectNames =
{
ProjectName.FromProject("[PROJECT]"),
},
};
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntries(IEnumerable<BillingAccountName>, string, string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(IEnumerable<BillingAccountName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableBillingAccountName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
IEnumerable<BillingAccountName> resourceNames = new BillingAccountName[]
{
BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntries(IEnumerable<FolderName>, string, string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(IEnumerable<FolderName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableFolderName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
IEnumerable<FolderName> resourceNames = new FolderName[]
{
FolderName.FromFolder("[FOLDER]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntries(IEnumerable<OrganizationName>, string, string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(IEnumerable<OrganizationName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableOrganizationName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
IEnumerable<OrganizationName> resourceNames = new OrganizationName[]
{
OrganizationName.FromOrganization("[ORGANIZATION]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntries(IEnumerable<ProjectName>, string, string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(IEnumerable<ProjectName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableProjectName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
IEnumerable<ProjectName> resourceNames = new ProjectName[]
{
ProjectName.FromProject("[PROJECT]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntries(IEnumerable<string>, string, string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntries(IEnumerable<string> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerablestring Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogEntriesResponseLogEntry | A pageable sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
IEnumerable<string> resourceNames = new string[]
{
"projects/[PROJECT]",
};
string filter = "";
string orderBy = "";
// Make the request
PagedEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntries(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
foreach (LogEntry item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogEntriesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(ListLogEntriesRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(ListLogEntriesRequest request, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
request | ListLogEntriesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
ListLogEntriesRequest request = new ListLogEntriesRequest
{
Filter = "",
OrderBy = "",
ResourceNamesAsProjectNames =
{
ProjectName.FromProject("[PROJECT]"),
},
};
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(IEnumerable<BillingAccountName>, string, string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(IEnumerable<BillingAccountName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableBillingAccountName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
IEnumerable<BillingAccountName> resourceNames = new BillingAccountName[]
{
BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(IEnumerable<FolderName>, string, string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(IEnumerable<FolderName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableFolderName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
IEnumerable<FolderName> resourceNames = new FolderName[]
{
FolderName.FromFolder("[FOLDER]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(IEnumerable<OrganizationName>, string, string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(IEnumerable<OrganizationName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableOrganizationName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
IEnumerable<OrganizationName> resourceNames = new OrganizationName[]
{
OrganizationName.FromOrganization("[ORGANIZATION]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(IEnumerable<ProjectName>, string, string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(IEnumerable<ProjectName> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerableProjectName Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
IEnumerable<ProjectName> resourceNames = new ProjectName[]
{
ProjectName.FromProject("[PROJECT]"),
};
string filter = "";
string orderBy = "";
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogEntriesAsync(IEnumerable<string>, string, string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> ListLogEntriesAsync(IEnumerable<string> resourceNames, string filter, string orderBy, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resourceNames | IEnumerablestring Required. Names of one or more parent resources from which to retrieve log entries:
May alternatively be one or more views:
Projects listed in the |
filter | string Optional. Only log entries that match the filter are returned. An empty
filter matches all log entries in the resources listed in |
orderBy | string Optional. How the results should be sorted. Presently, the only permitted
values are |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogEntriesResponseLogEntry | A pageable asynchronous sequence of LogEntry resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
IEnumerable<string> resourceNames = new string[]
{
"projects/[PROJECT]",
};
string filter = "";
string orderBy = "";
// Make the request
PagedAsyncEnumerable<ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(resourceNames, filter, orderBy);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogEntry item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogEntriesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (LogEntry item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<LogEntry> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogEntry item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(BillingAccountName, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(BillingAccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | BillingAccountName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
BillingAccountName parent = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(FolderName, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(OrganizationName, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(OrganizationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
OrganizationName parent = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(ProjectName, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(ListLogsRequest, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(ListLogsRequest request, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
request | ListLogsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
ListLogsRequest request = new ListLogsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
ResourceNamesAsProjectNames =
{
ProjectName.FromProject("[PROJECT]"),
},
};
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogs(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListLogsResponse, string> ListLogs(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | string Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListLogsResponsestring | A pageable sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (string item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogsAsync(BillingAccountName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogsResponse, string> ListLogsAsync(BillingAccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | BillingAccountName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogsResponsestring | A pageable asynchronous sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
BillingAccountName parent = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
PagedAsyncEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListLogsAsync(FolderName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListLogsResponse, string> ListLogsAsync(FolderName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The resource name to list logs for:
|
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListLogsResponsestring | A pageable asynchronous sequence of string resources. |
// Create client
LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync();
// Initialize request argument(s)
FolderName parent = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedAsyncEnumerable<ListLogsResponse, string> response = loggingServiceV2Client.ListLogsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((string item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListLogsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (string item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<string> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (string item in singlePage)
{
// Do something wi