public sealed class EventTarget
Represents the location error events will be sent.
Namespace
Google.Cloud.Diagnostics.CommonAssembly
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 | |
---|---|
Type | Description |
EventTargetKind |
LoggingClient
[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingServiceOptions.Client instead.")]
public LoggingServiceV2Client LoggingClient { get; }
The logging client.
Property Value | |
---|---|
Type | Description |
LoggingServiceV2Client |
LogName
[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingOptions.LogName instead.")]
public string LogName { get; }
The name of the log.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
LogTarget |
MonitoredResource
[Obsolete("Please use Google.Cloud.Diagnostics.Common.ErrorReportingOptions.MonitoredResource instead.")]
public MonitoredResource MonitoredResource { get; }
The resource being monitored.
Property Value | |
---|---|
Type | Description |
MonitoredResource |
ProjectId
public string ProjectId { get; }
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
logTarget | LogTarget Where to log to, such as a project or organization. Must not be null. |
logName | String The log name. Must not be null. |
loggingClient | LoggingServiceV2Client 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 |
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 | |
---|---|
Name | Description |
projectId | String 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. |
logName | String The log name. Must not be null. |
loggingClient | LoggingServiceV2Client 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 |
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 | |
---|---|
Name | Description |
target | LogTarget The LogTarget to create the EventTarget from. Must not be null. |
Returns | |
---|---|
Type | Description |
EventTarget |
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 | |
---|---|
Name | Description |
projectId | String The project ID to create the underlying LogTarget from. Must not be null. |
Returns | |
---|---|
Type | Description |
EventTarget |
For more information see "Formatting Log Error Messages" (https://cloud.google.com/error-reporting/docs/formatting-error-messages).