本文整理汇总了C#中TraceEvent类的典型用法代码示例。如果您正苦于以下问题:C# TraceEvent类的具体用法?C# TraceEvent怎么用?C# TraceEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TraceEvent类属于命名空间,在下文中一共展示了TraceEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetKey
public String GetKey(TraceEvent traceEvent)
{
// Original code combined the Provider GUID with the machine name
// but you cannot mix events with different partition keys in the same
// batch.
return Environment.MachineName;
}
示例2: Send
public void Send(TraceEvent eventData)
{
lock (this.eventList)
{
this.EventList.Add(eventData);
}
}
示例3: Format
public string Format(TraceEvent traceEvent)
{
//string ret = format;
return format.
Replace("{%ContextHolderId}", traceEvent.ContextIdentifier.ContextHolderId.ToString()).
Replace("{%ExternalId}", traceEvent.ContextIdentifier.ExternalId.ToString()).
Replace("{%ExternalReference}", traceEvent.ContextIdentifier.ExternalReference.ToString()).
Replace("{%ExternalParentId}", traceEvent.ContextIdentifier.ExternalParentId.ToString()).
Replace("{%InternalId}", traceEvent.ContextIdentifier.InternalId.ToString()).
Replace("{%InternalParentId}", traceEvent.ContextIdentifier.InternalParentId.ToString()).
Replace("{%ContextGuid}", traceEvent.ContextIdentifier.ContextGuid.ToString()).
Replace("{%HostName}", traceEvent.Location.HostName).
Replace("{%ModulePath}", traceEvent.Location.ModulePath).
Replace("{%Principal}", traceEvent.Principal.Name).
Replace("{%ThreadName}", traceEvent.Location.ThreadName).
Replace("{%Message}", traceEvent.Message).
Replace("{%Source}", traceEvent.Location.Source).
Replace("{%Type}", traceEvent.Type.ToString()).
Replace("{%Category}", traceEvent.Category.ToString()).
Replace("{%EventIdText}", traceEvent.EventIdText).
Replace("{%Time}", traceEvent.Time.ToString("dd-MMM-yyyyTHH:mm:ss (fff)")).
Replace("{%EventId}", traceEvent.EventId.ToString()
);
// TODO: Provide specific format handling for the DateTime (SD)
}
示例4: BeginIteration
public override void BeginIteration(TraceEvent beginEvent)
{
_objects = new ListMetricInfo();
_objects.clear();
_objects.hasCount = true;
_objects.hasBytes = true;
}
示例5: InstanceConfiguration
public InstanceConfiguration(DataSetConfiguration dataSet, ObservableCollection<MessageHandlerConfiguration> availableHandlers, TraceEvent trace, Action onModification)
{
AvailableMessageHandlers = availableHandlers;
AssociatedMessageHandlers = new ObservableCollection<MessageHandlerConfiguration>(availableHandlers.Where<MessageHandlerConfiguration>(x => x.Associated(dataSet.AssociationName)).ToArray<MessageHandlerConfiguration>());
DataSetConfiguration = dataSet;
PropertyChanged += (x, y) => onModification();
}
示例6: TraceEvent
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
{
var te = new TraceEvent {Cache = eventCache, Source = source, Type = eventType, Id = id};
Events.Add(te);
if (OnEventAdd != null)
OnEventAdd.Invoke(te);
}
示例7: Trace
/// <inheritdoc/>
public override void Trace(TraceEvent traceEvent)
{
if (traceEvent == null)
{
throw new ArgumentNullException("traceEvent");
}
if (ShouldIgnore(traceEvent))
{
return;
}
try
{
foreach (TraceFilter filter in Filters)
{
// trace must be passed to all filters (even if no notifications will be
// performed due to throttling) to allow them to continue to accumulate their results
if (filter.Filter(traceEvent))
{
// Notify all subscribers
Notify(filter);
}
}
}
catch
{
// Need to prevent infinite loops when calling out to user code
// I.e., user code exception in error handler causes error filter/subscriber
// to be called again.
}
}
示例8: EventReceived
private void EventReceived(TraceEvent traceEvent)
{
DisplayTraceEvent dte = new DisplayTraceEvent
{
TraceEvent = traceEvent,
};
foreach (IDisplayTraceEvents idt in _viewers)
{
if (idt.IsApplicable(traceEvent))
{
dte.DisplayTemplates.Add(idt.GetDisplayTemplate());
DataTemplate listTemplate = idt.GetListItemTemplate();
if (listTemplate != null)
{
dte.ListTemplate = listTemplate;
}
}
}
DisplayTraceEvents.Add(dte);
SelectedTab = 0;
}
示例9: Trace
public override void Trace(TraceEvent traceEvent)
{
// TODO: figure out the right log file format
// TODO: buffer logs and write only periodically
AppendLine(traceEvent.Message);
if (traceEvent.Exception != null)
{
if (traceEvent.Exception is FunctionInvocationException ||
traceEvent.Exception is AggregateException)
{
// we want to minimize the stack traces for function invocation
// failures, so we drill into the very inner exception, which will
// be the script error
Exception actualException = traceEvent.Exception;
while (actualException.InnerException != null)
{
actualException = actualException.InnerException;
}
AppendLine(actualException.Message);
}
else
{
AppendLine(traceEvent.Exception.ToString());
}
}
}
示例10: InvokeTextWriter
protected override void InvokeTextWriter(TraceEvent traceEvent)
{
if (MapTraceLevel(traceEvent.Source, traceEvent.Level) <= _traceConfig.ConsoleLevel)
{
// For Errors/Warnings we change the Console color
// for visibility
var holdColor = Console.ForegroundColor;
bool changedColor = false;
switch (traceEvent.Level)
{
case TraceLevel.Error:
Console.ForegroundColor = ConsoleColor.Red;
changedColor = true;
break;
case TraceLevel.Warning:
Console.ForegroundColor = ConsoleColor.Yellow;
changedColor = true;
break;
}
base.InvokeTextWriter(traceEvent);
if (changedColor)
{
Console.ForegroundColor = holdColor;
}
}
}
示例11: Write
public override void Write(string message)
{
var te = new TraceEvent
{Cache = new TraceEventCache(), Message = message, Type = TraceEventType.Information};
Events.Add(te);
if (OnEventAdd != null)
OnEventAdd.Invoke(te);
}
示例12: ProcessAction
public unsafe ProcessAction(TraceEvent traceEvent)
{
EventName = traceEvent.EventName;
OpcodeName = traceEvent.OpcodeName;
PayloadNames = traceEvent.PayloadNames;
//
AffectedKeys = new AffectedKeys(traceEvent);
}
示例13: Write
public override void Write(string message)
{
TraceEvent te = new TraceEvent();
te.Cache = new TraceEventCache();
te.Message = message;
te.Type = TraceEventType.Information;
Events.Add(te);
if(OnEventAdd != null)
OnEventAdd.Invoke(te);
}
示例14: Trace
public override void Trace(TraceEvent traceEvent)
{
if (Level < traceEvent.Level)
{
return;
}
_interceptor(traceEvent);
InnerWriter.Trace(traceEvent);
}
示例15: TraceEvent
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
{
TraceEvent te = new TraceEvent();
te.Cache = eventCache;
te.Source = source;
te.Type = eventType;
te.ID = id;
Events.Add(te);
if(OnEventAdd != null)
OnEventAdd.Invoke(te);
}