本文整理汇总了C#中TraceEventType类的典型用法代码示例。如果您正苦于以下问题:C# TraceEventType类的具体用法?C# TraceEventType怎么用?C# TraceEventType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TraceEventType类属于命名空间,在下文中一共展示了TraceEventType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TraceEvent
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message)
{
if ((this.Filter == null) || this.Filter.ShouldTrace(eventCache, source, eventType, id, message, null, null, null))
{
this.WriteLine(message);
}
}
示例2: ToStockSharp
private static LogLevels? ToStockSharp(TraceEventType eventType)
{
switch (eventType)
{
case TraceEventType.Critical:
case TraceEventType.Error:
return LogLevels.Error;
case TraceEventType.Warning:
return LogLevels.Warning;
case TraceEventType.Information:
return LogLevels.Info;
case TraceEventType.Verbose:
return LogLevels.Debug;
case TraceEventType.Start:
case TraceEventType.Stop:
case TraceEventType.Suspend:
case TraceEventType.Resume:
case TraceEventType.Transfer:
return null;
default:
throw new ArgumentOutOfRangeException("eventType");
}
}
示例3: DefaultGetLogLevel
static Level DefaultGetLogLevel(TraceEventType traceEventType)
{
switch (traceEventType)
{
case TraceEventType.Critical:
return Level.Fatal;
case TraceEventType.Error:
return Level.Error;
case TraceEventType.Warning:
return Level.Warn;
case TraceEventType.Information:
return Level.Info;
case TraceEventType.Verbose:
return Level.Trace;
case TraceEventType.Start:
return Level.Debug;
case TraceEventType.Stop:
return Level.Debug;
case TraceEventType.Suspend:
return Level.Debug;
case TraceEventType.Resume:
return Level.Debug;
case TraceEventType.Transfer:
return Level.Debug;
default:
throw new ArgumentOutOfRangeException("traceEventType");
}
}
示例4: DefaultIsLogEventEnabled
protected static bool DefaultIsLogEventEnabled(ILog commonLog, TraceEventType traceEventType)
{
switch (traceEventType)
{
case TraceEventType.Critical:
return commonLog.IsFatalEnabled;
case TraceEventType.Error:
return commonLog.IsErrorEnabled;
case TraceEventType.Warning:
return commonLog.IsWarnEnabled;
case TraceEventType.Information:
return commonLog.IsInfoEnabled;
case TraceEventType.Verbose:
return commonLog.IsTraceEnabled;
case TraceEventType.Start:
return commonLog.IsDebugEnabled;
case TraceEventType.Stop:
return commonLog.IsDebugEnabled;
case TraceEventType.Suspend:
return commonLog.IsDebugEnabled;
case TraceEventType.Resume:
return commonLog.IsDebugEnabled;
case TraceEventType.Transfer:
return commonLog.IsDebugEnabled;
default:
throw new ArgumentOutOfRangeException("traceEventType");
}
}
示例5: Log
public void Log(string message, TraceEventType eventType)
{
foreach (ILogger logger in this.loggers)
{
logger.Log(message, eventType);
}
}
示例6: Map
private LogLevel Map(TraceEventType eventType)
{
switch (eventType)
{
case TraceEventType.Critical:
return LogLevel.Fatal;
case TraceEventType.Error:
return LogLevel.Error;
case TraceEventType.Warning:
return LogLevel.Warn;
case TraceEventType.Information:
return LogLevel.Info;
case TraceEventType.Verbose:
return LogLevel.Trace;
case TraceEventType.Start:
return LogLevel.Info;
case TraceEventType.Stop:
return LogLevel.Info;
case TraceEventType.Suspend:
return LogLevel.Info;
case TraceEventType.Resume:
return LogLevel.Info;
case TraceEventType.Transfer:
return LogLevel.Info;
default:
throw new ArgumentOutOfRangeException("eventType");
}
}
示例7: Trace
void Trace(TraceEventType eventType, string message)
{
if (this.Switch.ShouldTrace(eventType) && this.Listeners != null)
{
TraceEvent(eventType, 0, m_header + message);
}
}
示例8: ShouldTrace
/// <summary>
/// Determines whether a filter is attached to this listener and, if so, asks whether it ShouldTrace applies to this data.
/// </summary>
protected virtual bool ShouldTrace(TraceEventCache eventCache, string source, TraceEventType eventType, int id,
string formatOrMessage, object[] args, object data1, object[] data)
{
return
!(Filter != null &&
!Filter.ShouldTrace(eventCache, source, eventType, id, formatOrMessage, args, data1, data));
}
示例9: TryGetValue
/// <summary>
/// Returns the value of Environment.MachineName
/// </summary>
/// <param name="value">The output parameter</param>
/// <param name="cache">Unused</param>
/// <param name="source">Unused</param>
/// <param name="eventType">Unused</param>
/// <param name="id">Unused</param>
/// <param name="formatOrMessage">Unused</param>
/// <param name="data">Unused</param>
/// <returns>True</returns>
public override bool TryGetValue(out object value, TraceEventCache cache, string source,
TraceEventType eventType, int id, string formatOrMessage,
object[] data)
{
value = Environment.MachineName;
return true;
}
示例10: TraceEvent
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
{
this.source = source;
this.eventType = eventType;
this.id = id;
TraceEvent(eventCache, source, eventType, id, "No additional information.");
}
示例11: DebugConsoleMessageEventArgs
public DebugConsoleMessageEventArgs(DateTime timestamp, string message, TraceEventType level, string source)
{
Timestamp = timestamp;
Message = message;
Level = level;
Source = source;
}
示例12: TraceEvent
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
{
if (_enabled)
{
WebSocketHost.Send($"{eventType}:{id} - {source}");
}
}
示例13: Trace
private void Trace(TraceEventType type, string message, params object[] parameters)
{
if (category.Source.Switch.ShouldTrace(type))
{
category.Source.TraceEvent(type, EVENT_ID, message, parameters);
}
}
示例14: TraceData
public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id,
params object[] data)
{
if (this.Filter != null &&
!this.Filter.ShouldTrace(eventCache, source, eventType, id, string.Empty, null, null, null))
return;
foreach (object obj in data)
{
if (obj is XPathNavigator)
{
using (var reader = ((XPathNavigator)obj).ReadSubtree())
{
reader.MoveToContent();
if (reader.IsStartElement())
Console.WriteLine(XElement.ReadFrom(reader).ToString(SaveOptions.OmitDuplicateNamespaces));
else
{
Console.WriteLine("Unable to write Xml data.");
}
}
}
else
{
Console.WriteLine(obj.ToString());
}
}
}
示例15: GetLogLevel
private static EventLevel GetLogLevel(TraceEventType traceEventType)
{
switch (traceEventType)
{
case TraceEventType.Critical:
return EventLevel.Critical;
case TraceEventType.Error:
return EventLevel.Error;
case TraceEventType.Warning:
return EventLevel.Warning;
case TraceEventType.Information:
return EventLevel.Informational;
case TraceEventType.Verbose:
case TraceEventType.Start:
case TraceEventType.Stop:
case TraceEventType.Suspend:
case TraceEventType.Resume:
case TraceEventType.Transfer:
return EventLevel.Verbose;
default:
throw new ArgumentOutOfRangeException(nameof(traceEventType));
}
}