• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Models.PersistentEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Exceptionless.Core.Models.PersistentEvent的典型用法代码示例。如果您正苦于以下问题:C# PersistentEvent类的具体用法?C# PersistentEvent怎么用?C# PersistentEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PersistentEvent类属于Exceptionless.Core.Models命名空间,在下文中一共展示了PersistentEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetEventSummaryData

        public override SummaryData GetEventSummaryData(PersistentEvent ev) {
            if (!ShouldHandle(ev))
                return null;

            var error = ev.GetError();
            var stackingTarget = error?.GetStackingTarget();
            if (stackingTarget?.Error == null)
                return null;

            dynamic data = new ExpandoObject();
            data.Id = ev.Id;
            data.Message = ev.Message;

            if (!String.IsNullOrEmpty(stackingTarget.Error.Type)) {
                data.Type = stackingTarget.Error.Type.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last();
                data.TypeFullName = stackingTarget.Error.Type;
            }

            if (stackingTarget.Method != null) {
                data.Method = stackingTarget.Method.Name;
                data.MethodFullName = stackingTarget.Method.GetFullName();
            }

            var requestInfo = ev.GetRequestInfo();
            if (!String.IsNullOrEmpty(requestInfo?.Path))
                data.Path = requestInfo.Path;

            return new SummaryData { TemplateKey = "event-error-summary", Data = data };
        }
开发者ID:Nangal,项目名称:Exceptionless,代码行数:29,代码来源:20_ErrorFormattingPlugin.cs


示例2: GenerateEvent

        public static PersistentEvent GenerateEvent(string[] organizationIds = null, string[] projectIds = null, string[] stackIds = null, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, DateTimeOffset? occurrenceDate = null, int maxErrorNestingLevel = 0, bool generateTags = true, bool generateData = true, bool isFixed = false, bool isHidden = false, string[] referenceIds = null, string type = null, string sessionId = null,  string userIdentity = null, decimal? value = -1, string semver = null)
        {
            if (!startDate.HasValue || startDate > DateTimeOffset.Now.AddHours(1))
                startDate = DateTimeOffset.Now.AddDays(-30);
            if (!endDate.HasValue || endDate > DateTimeOffset.Now.AddHours(1))
                endDate = DateTimeOffset.Now;

            var ev = new PersistentEvent {
                OrganizationId = organizationIds.Random(TestConstants.OrganizationId),
                ProjectId = projectIds.Random(TestConstants.ProjectId),
                ReferenceId = referenceIds.Random(),
                Date = occurrenceDate ?? RandomData.GetDateTimeOffset(startDate, endDate),
                Value = value.GetValueOrDefault() >= 0 ? value : RandomData.GetDecimal(0, Int32.MaxValue),
                IsFixed = isFixed,
                IsHidden = isHidden,
                StackId = stackIds.Random()
            };

            if (!String.IsNullOrEmpty(userIdentity))
                ev.SetUserIdentity(userIdentity);

            if (generateData) {
                for (int i = 0; i < RandomData.GetInt(1, 5); i++) {
                    string key = RandomData.GetWord();
                    while (ev.Data.ContainsKey(key) || key == Event.KnownDataKeys.Error)
                        key = RandomData.GetWord();

                    ev.Data.Add(key, RandomData.GetWord());
                }
            }

            if (generateTags) {
                for (int i = 0; i < RandomData.GetInt(1, 3); i++) {
                    string tag = TestConstants.EventTags.Random();
                    if (!ev.Tags.Contains(tag))
                        ev.Tags.Add(tag);
                }
            }

            if (String.IsNullOrEmpty(type) || String.Equals(type, Event.KnownTypes.Error, StringComparison.OrdinalIgnoreCase)) {
                ev.Type = Event.KnownTypes.Error;

                // limit error variation so that stacking will occur
                if (_randomErrors == null)
                    _randomErrors = new List<Error>(Enumerable.Range(1, 25).Select(i => GenerateError(maxErrorNestingLevel)));

                ev.Data[Event.KnownDataKeys.Error] = _randomErrors.Random();
            } else {
                ev.Type = type.ToLower();
            }

            if (!String.IsNullOrEmpty(sessionId))
                ev.SetSessionId(sessionId);

            if (ev.IsSessionStart())
                ev.Value = null;

            ev.SetVersion(semver);
            return ev;
        }
开发者ID:yonglehou,项目名称:Exceptionless,代码行数:60,代码来源:EventData.cs


示例3: GetEventSummaryData

        public override SummaryData GetEventSummaryData(PersistentEvent ev) {
            if (!ShouldHandle(ev))
                return null;
            
            var stackingTarget = ev.GetStackingTarget();
            if (stackingTarget?.Error == null)
                return null;

            var data = new Dictionary<string, object> { { "Id", ev.Id }, { "Message", ev.Message } };
            if (!String.IsNullOrEmpty(stackingTarget.Error.Type)) {
                data.Add("Type", stackingTarget.Error.Type.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last());
                data.Add("TypeFullName", stackingTarget.Error.Type);
            }

            if (stackingTarget.Method != null) {
                data.Add("Method", stackingTarget.Method.Name);
                data.Add("MethodFullName", stackingTarget.Method.GetFullName());
            }

            var requestInfo = ev.GetRequestInfo();
            if (!String.IsNullOrEmpty(requestInfo?.Path))
                data.Add("Path", requestInfo.Path);

            return new SummaryData { TemplateKey = "event-error-summary", Data = data };
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:25,代码来源:20_ErrorFormattingPlugin.cs


示例4: GetEventSummaryData

        public override SummaryData GetEventSummaryData(PersistentEvent ev) {
            if (!ShouldHandle(ev))
                return null;
            
            dynamic data = new ExpandoObject();
            data.SessionId = ev.SessionId;

            if (ev.IsSessionStart()) {
                data.Value = ev.Value.GetValueOrDefault();

                DateTime? endTime = ev.GetSessionEndTime();
                if (endTime.HasValue)
                    data.SessionEnd = endTime;
            }

            var identity = ev.GetUserIdentity();
            if (identity != null) {
                if (!String.IsNullOrEmpty(identity.Identity))
                    data.Identity = identity.Identity;
                
                if (!String.IsNullOrEmpty(identity.Name))
                    data.Name = identity.Name;
            }

            return new SummaryData { TemplateKey = "event-session-summary", Data = data };
        }
开发者ID:jackswei,项目名称:Exceptionless,代码行数:26,代码来源:50_SessionFormattingPlugin.cs


示例5: GetStackTitle

        public override string GetStackTitle(PersistentEvent ev)
        {
            if (!ShouldHandle(ev))
                return null;

            return !String.IsNullOrEmpty(ev.Source) ? ev.Source : "(Unknown)";
        }
开发者ID:yonglehou,项目名称:Exceptionless,代码行数:7,代码来源:40_UsageFormattingPlugin.cs


示例6: ValidateTag

         public void ValidateTag(string tag, bool isValid) {
             var ev = new PersistentEvent { Type = Event.KnownTypes.Error, Date = DateTimeOffset.Now, Id = "123456789012345678901234", OrganizationId = "123456789012345678901234", ProjectId = "123456789012345678901234", StackId = "123456789012345678901234" };
            ev.Tags.Add(tag);

            var result = _validator.Validate(ev);
            Assert.Equal(isValid, result.IsValid);
        }
开发者ID:Nangal,项目名称:Exceptionless,代码行数:7,代码来源:EventValidatorTests.cs


示例7: GetEventViewName

        public override string GetEventViewName(PersistentEvent ev)
        {
            if (!ShouldHandle(ev))
                return null;

            return "Event-Session";
        }
开发者ID:yonglehou,项目名称:Exceptionless,代码行数:7,代码来源:50_SessionFormattingPlugin.cs


示例8: GetStackTitle

        public override string GetStackTitle(PersistentEvent ev) {
            if (!ShouldHandle(ev))
                return null;

            var error = ev.GetSimpleError();
            return error?.Message;
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:7,代码来源:10_SimpleErrorFormattingPlugin.cs


示例9: WillNotSetLocation

        public async Task WillNotSetLocation() {
            var plugin = new GeoPlugin(await GetResolverAsync(Log));
            var ev = new PersistentEvent { Geo = GREEN_BAY_COORDINATES };
            await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });

            Assert.Equal(GREEN_BAY_COORDINATES, ev.Geo);
            Assert.Null(ev.GetLocation());
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:8,代码来源:GeoTests.cs


示例10: UpdateGeoAndlocation

 private void UpdateGeoAndlocation(PersistentEvent ev, GeoResult result, bool isValidLocation = true) {
     ev.Geo = result?.ToString();
     
     if (result != null && isValidLocation)
         ev.SetLocation(result.ToLocation());
     else
         ev.Data.Remove(Event.KnownDataKeys.Location);
 }
开发者ID:TrinityComputers,项目名称:Exceptionless,代码行数:8,代码来源:50_GeoPlugin.cs


示例11: EventNotification

 public EventNotification(EventNotificationWorkItem workItem, PersistentEvent ev) {
     EventId = workItem.EventId ?? ev.Id;
     IsNew = workItem.IsNew;
     IsCritical = workItem.IsCritical;
     IsRegression = workItem.IsRegression;
     TotalOccurrences = workItem.TotalOccurrences;
     ProjectName = workItem.ProjectName;
     Event = ev;
 }
开发者ID:Nangal,项目名称:Exceptionless,代码行数:9,代码来源:EventNotification.cs


示例12: AddManualStackSignatureData

        public async Task AddManualStackSignatureData(string stackingKey, bool willAddManualStackSignature) {
            var ev = new PersistentEvent();
            ev.SetManualStackingKey(stackingKey);

            var context = new EventContext(ev);
            var plugin = new ManualStackingPlugin();
            await plugin.EventBatchProcessingAsync(new List<EventContext> { context });
            Assert.Equal(willAddManualStackSignature, context.StackSignatureData.Count > 0);
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:9,代码来源:ManualStackingTests.cs


示例13: WillResetLocation

        public async Task WillResetLocation(string geo) {
            var plugin = new GeoPlugin(await GetResolverAsync(Log));
            
            var ev = new PersistentEvent { Geo = geo };
            await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });

            Assert.Null(ev.Geo);
            Assert.Null(ev.GetLocation());
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:9,代码来源:GeoTests.cs


示例14: GetEventSummaryData

        public SummaryData GetEventSummaryData(PersistentEvent ev) {
            var data = new Dictionary<string, object> {
                { "Message", GetStackTitle(ev) },
                { "Source", ev.Source },
                { "Type", ev.Type }
            };

            return new SummaryData { TemplateKey = "event-summary", Data = data };
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:9,代码来源:99_DefaultFormattingPlugin.cs


示例15: GetStackTitle

        public override string GetStackTitle(PersistentEvent ev) {
            if (!ShouldHandle(ev))
                return null;

            if (ev.IsSessionHeartbeat())
                return "Session Heartbeat";

            return ev.IsSessionStart() ? "Session Start" : "Session End";
        }
开发者ID:jackswei,项目名称:Exceptionless,代码行数:9,代码来源:50_SessionFormattingPlugin.cs


示例16: GetEventSummaryData

        public override SummaryData GetEventSummaryData(PersistentEvent ev)
        {
            if (!ShouldHandle(ev))
                return null;

            var data = new Dictionary<string, object> { { "Source", ev.Source } };
            AddUserIdentitySummaryData(data, ev.GetUserIdentity());

            return new SummaryData { TemplateKey = "event-feature-summary", Data = data };
        }
开发者ID:yonglehou,项目名称:Exceptionless,代码行数:10,代码来源:40_UsageFormattingPlugin.cs


示例17: GeneratePersistent

        public PersistentEvent GeneratePersistent() {
            var ev = new PersistentEvent {
                OrganizationId = "1ecd0826e447ad1e78877555",
                ProjectId = "1ecd0826e447ad1e78877ab2",
                StackId = "1ecd0826e447a44e78877ab1",
                Date = DateTime.UtcNow
            };

            PopulateEvent(ev);
            return ev;
        }
开发者ID:Nangal,项目名称:Exceptionless,代码行数:11,代码来源:RandomEventGenerator.cs


示例18: GetIpAddresses

        protected IEnumerable<string> GetIpAddresses(PersistentEvent ev, RequestInfo request) {
            if (request != null && !String.IsNullOrWhiteSpace(request.ClientIpAddress))
                yield return request.ClientIpAddress;

            var environmentInfo = ev.GetEnvironmentInfo();
            if (environmentInfo == null || String.IsNullOrWhiteSpace(environmentInfo.IpAddress))
                yield break;

            foreach (var ip in environmentInfo.IpAddress.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                yield return ip;
        }
开发者ID:hanu412,项目名称:Exceptionless,代码行数:11,代码来源:MigrationJobBase.cs


示例19: GetEventSummaryData

        public override SummaryData GetEventSummaryData(PersistentEvent ev)
        {
            var data = new Dictionary<string, object> {
                { "Message", GetStackTitle(ev) },
                { "Source", ev.Source },
                { "Type", ev.Type }
            };

            AddUserIdentitySummaryData(data, ev.GetUserIdentity());

            return new SummaryData { TemplateKey = "event-summary", Data = data };
        }
开发者ID:yonglehou,项目名称:Exceptionless,代码行数:12,代码来源:99_DefaultFormattingPlugin.cs


示例20: WillSetLocationFromGeo

        public async Task WillSetLocationFromGeo() {
            var plugin = new GeoPlugin(await GetResolverAsync(Log));
            var ev = new PersistentEvent { Geo = GREEN_BAY_IP };
            await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });

            Assert.NotNull(ev.Geo);
            Assert.NotEqual(GREEN_BAY_IP, ev.Geo);

            var location = ev.GetLocation();
            Assert.Equal("US", location?.Country);
            Assert.Equal("WI", location?.Level1);
            Assert.Equal("Green Bay", location?.Locality);
        }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:13,代码来源:GeoTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EventProcessor.EventContext类代码示例发布时间:2022-05-24
下一篇:
C# ExceptionLog.ExceptionLog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap