Google.Cloud.Logging.V2: LogNameOneof

Google.Cloud.Logging.V2: LogNameOneof

我正在编写一个 .Net Core 实用程序,它基本上是一个包装器,可以将 messages/logs 推送到 GCP Stackdriver。 Google.cloud 站点

上还有对代码的引用

代码如下:

using System;
// Imports the Google Cloud Logging client library
using Google.Cloud.Logging.V2;
using Google.Cloud.Logging.Type;
using System.Collections.Generic;
using Google.Api;

namespace GoogleCloudSamples
{
    public class QuickStart
    {
        public static void Main(string[] args)
        {
            // Your Google Cloud Platform project ID.
            string projectId = "YOUR-PROJECT-ID";

            // Instantiates a client.
            var client = LoggingServiceV2Client.Create();

            // Prepare new log entry.
            LogEntry logEntry = new LogEntry();
            string logId = "my-log";
            LogName logName = new LogName(projectId, logId);
            LogNameOneof logNameToWrite = LogNameOneof.From(logName);
            logEntry.LogName = logName.ToString();
            logEntry.Severity = LogSeverity.Info;
...

我的问题是这一行 LogNameOneof logNameToWrite = LogNameOneof.From(logName); - 我收到一个错误 LogNameOneof,还有其他人能够完成这项工作吗?

我查看了最近在 github 上所做的描述此配置的更改,似乎“LogNameOneof logNameToWrite = LogNameOneof.From(logName);”已替换为“logEntry.LogNameAsLogName = logName;”。从最近的 cleanup 4 月 6 日完成的

可以看出这一变化。