/// <summary> /// Writes log entries to Cloud Logging. /// All log entries in Cloud Logging are written by this method. /// </summary> /// <param name="log_name"> /// Optional. A default log resource name for those log entries in `entries` /// that do not specify their own `logName`. Example: /// `"projects/my-project/logs/syslog"`. See /// [LogEntry][google.logging.v2.LogEntry]. /// </param> /// <param name="resource"> /// Optional. A default monitored resource for those log entries in `entries` /// that do not specify their own `resource`. /// </param> /// <param name="labels"> /// Optional. User-defined `key:value` items that are added to /// the `labels` field of each log entry in `entries`, except when a log /// entry specifies its own `key:value` item with the same key. /// Example: `{ "size": "large", "color":"red" }` /// </param> /// <param name="entries"> /// Required. The log entries to write. The log entries must have values for /// all required fields. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override WriteLogEntriesResponse WriteLogEntries( string logName, MonitoredResource resource, IDictionary <string, string> labels, IEnumerable <LogEntry> entries, CallSettings callSettings = null) { WriteLogEntriesRequest request = new WriteLogEntriesRequest { LogName = logName, Resource = resource, Labels = { labels }, Entries = { entries }, }; return(GrpcClient.WriteLogEntries( request, _clientHelper.BuildCallOptions(null, callSettings))); }
/// <summary> /// Writes log entries to Cloud Logging. /// All log entries in Cloud Logging are written by this method. /// </summary> /// <param name="log_name"> /// Optional. A default log resource name for those log entries in `entries` /// that do not specify their own `logName`. Example: /// `"projects/my-project/logs/syslog"`. See /// [LogEntry][google.logging.v2.LogEntry]. /// </param> /// <param name="resource"> /// Optional. A default monitored resource for those log entries in `entries` /// that do not specify their own `resource`. /// </param> /// <param name="labels"> /// Optional. User-defined `key:value` items that are added to /// the `labels` field of each log entry in `entries`, except when a log /// entry specifies its own `key:value` item with the same key. /// Example: `{ "size": "large", "color":"red" }` /// </param> /// <param name="entries"> /// Required. The log entries to write. The log entries must have values for /// all required fields. /// </param> /// <param name="cancellationToken">If not null, a <see cref="CancellationToken"/> to use for this RPC.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override Task <WriteLogEntriesResponse> WriteLogEntriesAsync( string logName, MonitoredResource resource, IDictionary <string, string> labels, IEnumerable <LogEntry> entries, CancellationToken?cancellationToken = null, CallSettings callSettings = null) { WriteLogEntriesRequest request = new WriteLogEntriesRequest { LogName = logName, Resource = resource, Labels = { labels }, Entries = { entries }, }; return(GrpcClient.WriteLogEntriesAsync( request, _clientHelper.BuildCallOptions(cancellationToken, callSettings) ).ResponseAsync); }