# Google.Cloud.Diagnostics.Common - Class EventTarget (5.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.3.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget)
- [5.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.EventTarget)
- [5.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.EventTarget)
- [5.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.EventTarget)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.EventTarget)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.EventTarget)

    public sealed class EventTarget

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class EventTarget.

Represents the location error events will be sent.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> EventTarget

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Diagnostics.Common](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)

## Assembly

Google.Cloud.Diagnostics.Common.dll

## Properties

### Kind

    public EventTargetKind Kind { get; }

The type of location to send error events to.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTargetKind` |   |

### LogTarget

    public LogTarget LogTarget { get; }

If this even target type is [Logging](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTargetKind#Google_Cloud_Diagnostics_Common_EventTargetKind_Logging), this is
the target log to send error reports to. It will be null otherwise.
Note that currently, only [Logging](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTargetKind#Google_Cloud_Diagnostics_Common_EventTargetKind_Logging) is supported
then, in practice, this will never be null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTarget` |   |

### ProjectId

    public string ProjectId { get; }

If [LogTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget#Google_Cloud_Diagnostics_Common_EventTarget_LogTarget) is of [Project](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTargetKind#Google_Cloud_Diagnostics_Common_LogTargetKind_Project)
this is [ProjectId](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTarget#Google_Cloud_Diagnostics_Common_LogTarget_ProjectId). Null otherwise.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

## Methods

### ForLogTarget(LogTarget)

    public static EventTarget ForLogTarget(LogTarget target)

Creates a new [EventTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `target` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.LogTarget` The [LogTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget#Google_Cloud_Diagnostics_Common_EventTarget_LogTarget) to create the [EventTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget) from. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget` |   |

**Remarks** For more information see "Formatting Log Error Messages"
(<https://cloud.google.com/error-reporting/docs/formatting-error-messages>).

### ForProject(string)

    public static EventTarget ForProject(string projectId)

Creates a new [EventTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `projectId` | `https://learn.microsoft.com/dotnet/api/system.string` The project ID to create the underlying [LogTarget](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget#Google_Cloud_Diagnostics_Common_EventTarget_LogTarget) from. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.EventTarget` |   |

**Remarks** For more information see "Formatting Log Error Messages"
(<https://cloud.google.com/error-reporting/docs/formatting-error-messages>).