本文整理汇总了C#中FunctionId.GetEventName方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionId.GetEventName方法的具体用法?C# FunctionId.GetEventName怎么用?C# FunctionId.GetEventName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionId
的用法示例。
在下文中一共展示了FunctionId.GetEventName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Log
public void Log(FunctionId functionId, LogMessage logMessage)
{
var kvLogMessage = logMessage as KeyValueLogMessage;
if (kvLogMessage == null)
{
return;
}
try
{
// guard us from exception thrown by telemetry
if (!kvLogMessage.ContainsProperty)
{
_session.PostSimpleEvent(functionId.GetEventName());
return;
}
var telemetryEvent = CreateTelemetryEvent(functionId, logMessage: kvLogMessage);
_session.PostEvent(telemetryEvent);
}
catch
{
}
}
示例2: LogBlockStart
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
{
var eventName = functionId.GetEventName();
_pendingActivities[uniquePairId] = new TelemetryActivity(_service, eventName, startCodeMarker: 0, endCodeMarker: 0, codeMarkerData: null, parentCorrelationId: Guid.Empty);
}
示例3: CreateTelemetryEvent
private IVsTelemetryEvent CreateTelemetryEvent(FunctionId functionId, string eventKey = null, KeyValueLogMessage logMessage = null)
{
var eventName = functionId.GetEventName(eventKey);
var telemetryEvent = _service.CreateEvent(eventName);
if (logMessage == null || !logMessage.ContainsProperty)
{
return telemetryEvent;
}
foreach (var kv in logMessage.Properties)
{
var propertyName = functionId.GetPropertyName(kv.Key);
// call SetProperty. VS telemetry will take care of finding correct
// API based on given object type for us.
//
// numeric data will show up in ES with measurement prefix.
telemetryEvent.SetProperty(propertyName, kv.Value);
}
return telemetryEvent;
}