Show / Hide Table of Contents

Class EventTarget

Represents the location error events will be sent.

Inheritance
System.Object
EventTarget
Inherited Members
System.Object.ToString()
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Cloud.Diagnostics.Common
Assembly: Google.Cloud.Diagnostics.Common.dll
Syntax
public sealed class EventTarget

Properties

Kind

The location to send error events to.

Declaration
public EventTargetKind Kind { get; }
Property Value
Type Description
EventTargetKind

LoggingClient

The logging client.

Declaration
public LoggingServiceV2Client LoggingClient { get; }
Property Value
Type Description
LoggingServiceV2Client

LogName

The name of the log.

Declaration
public string LogName { get; }
Property Value
Type Description
System.String

LogTarget

Where to log to, such as project or organization.

Declaration
public LogTarget LogTarget { get; }
Property Value
Type Description
LogTarget

MonitoredResource

The resource being monitored.

Declaration
public MonitoredResource MonitoredResource { get; }
Property Value
Type Description
MonitoredResource

ProjectId

The Google Cloud Platform project Id.

Declaration
public string ProjectId { get; }
Property Value
Type Description
System.String

Methods

ForLogging(LogTarget, String, LoggingServiceV2Client, MonitoredResource)

Creates a new EventTarget instance that will report to the Stackdriver Logging API. The events are then automatically propagated to the Stackdriver Error Logging API from the Stackdriver Logging API.

Declaration
public static EventTarget ForLogging(LogTarget logTarget, string logName = "stackdriver-error-reporting", LoggingServiceV2Client loggingClient = null, MonitoredResource monitoredResource = null)
Parameters
Type Name Description
LogTarget logTarget

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

System.String logName

The log name. Must not be null.

LoggingServiceV2Client loggingClient

The logging client.

MonitoredResource monitoredResource

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
Type Description
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)

Creates a new EventTarget instance that will report to the Stackdriver Logging API. The events are then automatically propagated to the Stackdriver Error Logging API from the Stackdriver Logging API.

Declaration
public static EventTarget ForLogging(string projectId = null, string logName = "stackdriver-error-reporting", LoggingServiceV2Client loggingClient = null, MonitoredResource monitoredResource = null)
Parameters
Type Name Description
System.String projectId

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.

System.String logName

The log name. Must not be null.

LoggingServiceV2Client loggingClient

The logging client.

MonitoredResource monitoredResource

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
Type Description
EventTarget
Remarks

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

Back to top