当前位置: 首页>>代码示例>>C#>>正文


C# EventLevel类代码示例

本文整理汇总了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);
        }
开发者ID:EdHastings,项目名称:semantic-logging,代码行数:25,代码来源:TraceEventUtil.cs

示例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);
            }
        }
开发者ID:PUG-IT,项目名称:06Etanche,代码行数:32,代码来源:ProjectHistoryManager.cs

示例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>();
        }
开发者ID:EdHastings,项目名称:semantic-logging,代码行数:41,代码来源:EventSourceSettings.cs

示例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);
     }
 }
开发者ID:Lawo,项目名称:ember-plus-sharp,代码行数:11,代码来源:ConsoleLogListener.cs

示例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();
        }
开发者ID:stephenosrajan,项目名称:NuGet.Services.Platform,代码行数:26,代码来源:AzureServiceHost.cs

示例6: OnProcessEvent

 protected void OnProcessEvent(EventLevel eventLevel, string message)
 {
     if (ProcessEventOccurred != null)
     {
         ProcessEventOccurred(this, new ProcessEventArgs(DateTime.Now, message, eventLevel));
     }
 }
开发者ID:joncrump,项目名称:Jon.Crump.Common,代码行数:7,代码来源:ActionHandlerBase.cs

示例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);
        }
开发者ID:Brar,项目名称:entlib,代码行数:7,代码来源:TraceEventUtil.cs

示例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;
 }
开发者ID:guyzo,项目名称:semantic-logging,代码行数:14,代码来源:EventTextFormatter.cs

示例9: EnableEvents

 public static void EnableEvents(this EventListener self, IEnumerable<EventSource> sources, EventLevel level)
 {
     foreach (var source in sources)
     {
         self.EnableEvents(source, level);
     }
 }
开发者ID:stephenosrajan,项目名称:NuGet.Services.Platform,代码行数:7,代码来源:EventListenerExtensions.cs

示例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;
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:29,代码来源:TraceLoggingTypeInfo.cs

示例11: TestEventListener

        public TestEventListener(string taretSourceName, EventLevel level)
        {
            // Store the arguments
            _targetSourceName = taretSourceName;
            _level = level;

            LoadSourceList();
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:8,代码来源:TestEventListener.cs

示例12: GetLogLevel

        private ErrorLevel GetLogLevel(EventLevel level)
        {
            ErrorLevel mappedLevel;
            if (LevelMap.TryGetValue(level, out mappedLevel))
                return mappedLevel;

            return ErrorLevel.Debug;
        }
开发者ID:richardszalay,项目名称:semantic-logging-sentry,代码行数:8,代码来源:EventEntryJsonPacketFactory.cs

示例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;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:EventProviderBase.cs

示例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);
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:EventProviderBase.cs

示例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;
		}
开发者ID:stas-sultanov,项目名称:SXN.Core,代码行数:14,代码来源:DiagnosticsEventArgs.cs


注:本文中的EventLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。