If this even target type is Logging, this is
the target log to send error reports to. It will be null otherwise.
Note that currently, only Logging is supported
then, in practice, this will never be null.
public static EventTarget ForLogTarget(LogTarget target)
Creates a new EventTarget instance that will report to the Google Cloud Logging API.
The events are then automatically propagated to the Google Cloud Error Logging API from the
Google Cloud Logging API.
public static EventTarget ForProject(string projectId)
Creates a new EventTarget instance that will report to the Google Cloud Logging API.
The events are then automatically propagated to the Google Cloud Error Logging API from the
Google Cloud Logging API.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eEventTarget\u003c/code\u003e class in the \u003ccode\u003eGoogle.Cloud.Diagnostics.Common\u003c/code\u003e namespace represents the destination where error events will be sent, primarily to the Google Cloud Logging API.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eEventTarget\u003c/code\u003e is 5.2.0, with previous versions also documented, including 5.1.0, 5.0.0, 4.4.0, and 4.3.1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eEventTarget\u003c/code\u003e has properties \u003ccode\u003eKind\u003c/code\u003e, \u003ccode\u003eLogTarget\u003c/code\u003e, and \u003ccode\u003eProjectId\u003c/code\u003e to specify the error event location, target log, and project ID respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides static methods \u003ccode\u003eForLogTarget\u003c/code\u003e and \u003ccode\u003eForProject\u003c/code\u003e to create an \u003ccode\u003eEventTarget\u003c/code\u003e instance for reporting to the Google Cloud Logging API, automatically propagating to the Google Cloud Error Logging API.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eLogTarget\u003c/code\u003e can be set as either a project or through logging, and it only supports \u003ccode\u003eLogging\u003c/code\u003e currently.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Diagnostics.Common - Class EventTarget (5.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget)\n- [5.2.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.EventTarget)\n- [5.1.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.EventTarget)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.EventTarget)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.EventTarget)\n- [4.3.1](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.EventTarget) \n\n public sealed class EventTarget\n\nReference documentation and code samples for the Google.Cloud.Diagnostics.Common class EventTarget.\n\nRepresents the location error events will be sent. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e EventTarget \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Diagnostics.Common](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)\n\nAssembly\n--------\n\nGoogle.Cloud.Diagnostics.Common.dll\n\nProperties\n----------\n\n### Kind\n\n public EventTargetKind Kind { get; }\n\nThe type of location to send error events to.\n\n### LogTarget\n\n public LogTarget LogTarget { get; }\n\nIf this even target type is [Logging](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTargetKind#Google_Cloud_Diagnostics_Common_EventTargetKind_Logging), this is\nthe target log to send error reports to. It will be null otherwise.\nNote that currently, only [Logging](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTargetKind#Google_Cloud_Diagnostics_Common_EventTargetKind_Logging) is supported\nthen, in practice, this will never be null.\n\n### ProjectId\n\n public string ProjectId { get; }\n\nIf [LogTarget](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget#Google_Cloud_Diagnostics_Common_EventTarget_LogTarget) is of [Project](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTargetKind#Google_Cloud_Diagnostics_Common_LogTargetKind_Project)\nthis is [ProjectId](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTarget#Google_Cloud_Diagnostics_Common_LogTarget_ProjectId). Null otherwise.\n\nMethods\n-------\n\n### ForLogTarget(LogTarget)\n\n public static EventTarget ForLogTarget(LogTarget target)\n\nCreates a new [EventTarget](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget) instance that will report to the Google Cloud Logging API.\nThe events are then automatically propagated to the Google Cloud Error Logging API from the\nGoogle Cloud Logging API.\n\n**Remarks** \nFor more information see \"Formatting Log Error Messages\"\n(\u003chttps://cloud.google.com/error-reporting/docs/formatting-error-messages\u003e).\n\n### ForProject(string)\n\n public static EventTarget ForProject(string projectId)\n\nCreates a new [EventTarget](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget) instance that will report to the Google Cloud Logging API.\nThe events are then automatically propagated to the Google Cloud Error Logging API from the\nGoogle Cloud Logging API.\n\n**Remarks** \nFor more information see \"Formatting Log Error Messages\"\n(\u003chttps://cloud.google.com/error-reporting/docs/formatting-error-messages\u003e)."]]