Class EventTarget (4.4.0)

public sealed class EventTarget

Represents the location error events will be sent.

Inheritance

Object > EventTarget

Namespace

Google.Cloud.Diagnostics.Common

Assembly

Google.Cloud.Diagnostics.Common.dll

Constructors

EventTarget()

[Obsolete("Do not use as the instance built by this constructor is not valid and never has been.")]
public EventTarget()

Default constructor. Which does nothing and has never do. Obsolete.

Properties

Kind

public EventTargetKind Kind { get; }

The type of location to send error events to.

Property Value
TypeDescription
EventTargetKind

LoggingClient

[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingServiceOptions.Client instead.")]
public LoggingServiceV2Client LoggingClient { get; }

The logging client.

Property Value
TypeDescription
LoggingServiceV2Client

LogName

[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingOptions.LogName instead.")]
public string LogName { get; }

The name of the log.

Property Value
TypeDescription
String

LogTarget

public LogTarget LogTarget { get; }

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.

Property Value
TypeDescription
LogTarget

MonitoredResource

[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingOptions.MonitoredResource instead.")]
public MonitoredResource MonitoredResource { get; }

The resource being monitored.

Property Value
TypeDescription
MonitoredResource

ProjectId

public string ProjectId { get; }

If LogTarget is of Project this is ProjectId. Null otherwise.

Property Value
TypeDescription
String

Methods

ForLogging(LogTarget, String, LoggingServiceV2Client, MonitoredResource)

[Obsolete("Please use Google.Cloud.Diagnostics.Common.EventTarget.FromLogTarget instead.")]
public static EventTarget ForLogging(LogTarget logTarget, string logName = "stackdriver-error-reporting", LoggingServiceV2Client loggingClient = null, MonitoredResource monitoredResource = null)

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.

Parameters
NameDescription
logTargetLogTarget

Where to log to, such as a project or organization. Must not be null.

logNameString

The log name. Must not be null.

loggingClientLoggingServiceV2Client

The logging client.

monitoredResourceMonitoredResource

Optional, the monitored resource. The monitored resource will be automatically detected if it is not set and will default to the global resource if the detection fails. See: https://cloud.google.com/logging/docs/api/v2/resource-list

Returns
TypeDescription
EventTarget
Remarks

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

ForLogging(String, String, LoggingServiceV2Client, MonitoredResource)

[Obsolete("Please use Google.Cloud.Diagnostics.Common.EventTarget.FromProject instead.")]
public static EventTarget ForLogging(string projectId = null, string logName = "stackdriver-error-reporting", LoggingServiceV2Client loggingClient = null, MonitoredResource monitoredResource = null)

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.

Parameters
NameDescription
projectIdString

Optional if running on Google App Engine or Google Compute Engine. The Google Cloud Platform project ID. If running on GAE or GCE the project ID will be detected from the platform.

logNameString

The log name. Must not be null.

loggingClientLoggingServiceV2Client

The logging client.

monitoredResourceMonitoredResource

Optional, the monitored resource. The monitored resource will be automatically detected if it is not set and will default to the global resource if the detection fails. See: https://cloud.google.com/logging/docs/api/v2/resource-list

Returns
TypeDescription
EventTarget
Remarks

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

ForLogTarget(LogTarget)

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.

Parameter
NameDescription
targetLogTarget

The LogTarget to create the EventTarget from. Must not be null.

Returns
TypeDescription
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 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
NameDescription
projectIdString

The project ID to create the underlying LogTarget from. Must not be null.

Returns
TypeDescription
EventTarget
Remarks

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