本文整理汇总了C#中EventLevel类的典型用法代码示例。如果您正苦于以下问题:C# EventLevel类的具体用法?C# EventLevel怎么用?C# EventLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventLevel类属于命名空间,在下文中一共展示了EventLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnableProvider
internal static void EnableProvider(
TraceEventSession session,
Guid providerId,
EventLevel level,
EventKeywords matchAnyKeyword,
IEnumerable<KeyValuePair<string, string>> arguments,
IEnumerable<string> processNamesToFilter,
bool sendManifest = true)
{
// Make explicit the invocation for requesting the manifest from the EventSource (Provider).
var argumentsDictionary = arguments.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
if (sendManifest)
{
argumentsDictionary["Command"] = "SendManifest";
}
var options =
new TraceEventProviderOptions
{
Arguments = argumentsDictionary,
ProcessNameFilter = processNamesToFilter.ToArray()
};
session.EnableProvider(providerId, (TraceEventLevel)level, (ulong)matchAnyKeyword, options);
}
示例2: Add
private ActionResult Add(string projectId, int? transitionId, EventLevel level, EventType eventType, AppUser creator, object item, DateTime? createdOn = null)
{
try
{
var i = new ProjectHistory
{
CreatedBy = creator,
CreatedOn = createdOn ?? DateTime.UtcNow,
Description = JsonConvert.SerializeObject(item),
Level = level,
ProjectId = projectId,
TransitionId = transitionId,
Type = eventType
};
if (!_dbContext.ChangeTracker.Entries().Where(e => e.State != EntityState.Unchanged).Any())
{
_dbContext.ProjectHistory.Add(i);
_dbContext.SaveChanges();
}
else
{
_dbContext.ProjectHistory.Add(i);
}
return ActionResult.Success(item);
}
catch(Exception ex)
{
return ActionResult.Failed(ex);
}
}
示例3: EventSourceSettings
/// <summary>
/// Initializes a new instance of the <see cref="EventSourceSettings" /> class.
/// </summary>
/// <param name="name">The friendly event source name.</param>
/// <param name="eventSourceId">The event source id.</param>
/// <param name="level">The level.</param>
/// <param name="matchAnyKeyword">The match any keyword.</param>
/// <param name="arguments">The arguments for the event source.</param>
/// <param name="processNameFilters">The the process filters.</param>
/// <exception cref="ConfigurationException">A validation exception.</exception>
public EventSourceSettings(
string name = null,
Guid? eventSourceId = null,
EventLevel level = EventLevel.LogAlways,
EventKeywords matchAnyKeyword = Keywords.All,
IEnumerable<KeyValuePair<string, string>> arguments = null,
IEnumerable<string> processNameFilters = null)
{
// If no Id, Name should not be optional so we may derive an Id from it.
if (!eventSourceId.HasValue || eventSourceId == Guid.Empty)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ConfigurationException(Properties.Resources.MissingEventSourceNameAndId);
}
eventSourceId = TraceEventProviders.GetEventSourceGuidFromName(name);
}
else if (!string.IsNullOrWhiteSpace(name))
{
// throw and both name & Id specified
throw new ConfigurationException(Properties.Resources.EventSourceAmbiguityError);
}
this.EventSourceId = eventSourceId.Value;
this.Name = name ?? eventSourceId.ToString(); // Set a not null value for later use
this.Level = level;
this.MatchAnyKeyword = matchAnyKeyword;
this.Arguments = arguments ?? Enumerable.Empty<KeyValuePair<string, string>>();
this.ProcessNamesToFilter = processNameFilters ?? Enumerable.Empty<string>();
}
示例4: Initialize
/// <summary>
/// Initializes the ConsoleLogListener.
/// </summary>
/// <param name="eventLevel">The event level.</param>
public static void Initialize(EventLevel eventLevel)
{
if (instance == null)
{
instance = new ConsoleLogListener(eventLevel);
}
}
示例5: Start
public override Task<bool> Start()
{
// Load the trace level if specified
string levelStr = GetConfigurationSetting("Trace.Level");
EventLevel level;
if (!String.IsNullOrEmpty(levelStr) && Enum.TryParse<EventLevel>(levelStr, true, out level))
{
TraceLevel = level;
}
else
{
TraceLevel = EventLevel.Warning;
}
RoleEnvironment.Changing += (_, __) => ConfigurationChanging();
RoleEnvironment.Changed += (_, __) => ConfigurationChanging();
RoleEnvironment.StatusCheck += (sender, e) =>
{
if (GetCurrentStatus() == ServiceStatus.Busy)
{
e.SetBusy();
}
};
return base.Start();
}
示例6: OnProcessEvent
protected void OnProcessEvent(EventLevel eventLevel, string message)
{
if (ProcessEventOccurred != null)
{
ProcessEventOccurred(this, new ProcessEventArgs(DateTime.Now, message, eventLevel));
}
}
示例7: EnableProvider
internal static void EnableProvider(TraceEventSession session, Guid providerId, EventLevel level, EventKeywords matchAnyKeyword, bool sendManifest = true)
{
// Make explicit the invocation for requesting the manifest from the EventSource (Provider).
var values = sendManifest ? new Dictionary<string, string>() { { "Command", "SendManifest" } } : null;
session.EnableProvider(providerId, (TraceEventLevel)level, (ulong)matchAnyKeyword, 0, TraceEventOptions.None, values);
}
示例8: EventTextFormatter
/// <summary>
/// Initializes a new instance of the <see cref="EventTextFormatter" /> class.
/// </summary>
/// <param name="header">The header.</param>
/// <param name="footer">The footer.</param>
/// <param name="verbosityThreshold">The verbosity threshold.</param>
/// <param name="dateTimeFormat">The date time format used for timestamp value.</param>
public EventTextFormatter(string header = null, string footer = null, EventLevel verbosityThreshold = DefaultVerbosityThreshold, string dateTimeFormat = null)
{
this.Header = header;
this.Footer = footer;
this.VerbosityThreshold = verbosityThreshold;
this.DateTimeFormat = dateTimeFormat;
}
示例9: EnableEvents
public static void EnableEvents(this EventListener self, IEnumerable<EventSource> sources, EventLevel level)
{
foreach (var source in sources)
{
self.EnableEvents(source, level);
}
}
示例10: TraceLoggingTypeInfo
internal TraceLoggingTypeInfo(
Type dataType,
string name,
EventLevel level,
EventOpcode opcode,
EventKeywords keywords,
EventTags tags)
{
if (dataType == null)
{
throw new ArgumentNullException("dataType");
}
if (name == null)
{
throw new ArgumentNullException("eventName");
}
Contract.EndContractBlock();
Statics.CheckName(name);
this.name = name;
this.keywords = keywords;
this.level = level;
this.opcode = opcode;
this.tags = tags;
this.dataType = dataType;
}
示例11: TestEventListener
public TestEventListener(string taretSourceName, EventLevel level)
{
// Store the arguments
_targetSourceName = taretSourceName;
_level = level;
LoadSourceList();
}
示例12: GetLogLevel
private ErrorLevel GetLogLevel(EventLevel level)
{
ErrorLevel mappedLevel;
if (LevelMap.TryGetValue(level, out mappedLevel))
return mappedLevel;
return ErrorLevel.Debug;
}
示例13: IsEnabled
public bool IsEnabled(EventLevel level, EventKeywords keywords)
{
if (!m_providerEnabled)
return false;
if (m_level != 0 && m_level < level)
return false;
return m_matchAnyKeyword == 0 || (keywords & m_matchAnyKeyword) != 0;
}
示例14: WriteMessage
public void WriteMessage(string eventMessage, EventLevel level, EventKeywords keywords)
{
#if ETW_SUPPORTED
if(m_provider != null)
m_provider.WriteMessageEvent(eventMessage, (byte)level, (long)keywords);
#endif
WriteToAllStreams(0, eventMessage);
}
示例15: DiagnosticsEventArgs
/// <summary>
/// Initializes a new instance of <see cref="DiagnosticsEventArgs" /> class.
/// </summary>
/// <param name="level">The level of the event.</param>
/// <param name="message">The message of the event.</param>
/// <param name="source">The source of the event.</param>
public DiagnosticsEventArgs(EventLevel level, String message, String source)
{
Level = level;
Message = message;
Source = source;
}