/// <summary>
        /// Create the best stub of a request that we can using the message level and body
        /// </summary>
        /// <param name="level"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        protected DataModel Create(string level, BodyModel body)
        {
            var model = new DataModel(level, body);

            model.CodeVersion = Configuration.CodeVersion;
            model.Environment = Configuration.Environment;
            model.Platform    = Configuration.Platform;
            model.Language    = Configuration.Language;
            model.Framework   = Configuration.Framework;

            model.Timestamp = (ulong)Now();

            model.Notifier = NotifierModelBuilder.CreateFromAssemblyInfo();

            var currentHttpRequest = GetCurrentHttpRequest();

            if (currentHttpRequest == null)
            {
                model.Request = new RequestModel();
                model.Server  = new ServerModel();
                model.Person  = new PersonModel();
            }
            else
            {
                model.Request = RequestModelBuilder.CreateFromHttpRequest(currentHttpRequest, HttpContext.Current.Session, Configuration.ScrubParams);
                model.Server  = ServerModelBuilder.CreateFromHttpRequest(currentHttpRequest);
                model.Person  = PersonModelBuilder.CreateFromHttpRequest(currentHttpRequest);
            }

            model.Server.GitSha = Configuration.GitSha;

            return(model);
        }
        /// <summary>
        /// Create the best stub of a request that we can using the message level and body
        /// </summary>
        /// <param name="level"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        protected DataModel Create(string level, BodyModel body, IDictionary <string, string> requestSession, PersonModel person)
        {
            var model = new DataModel(level, body);

            model.CodeVersion = Configuration.CodeVersion;
            model.Environment = Configuration.Environment;
            model.Platform    = Configuration.Platform;
            model.Language    = Configuration.Language;
            model.Framework   = Configuration.Framework;

            model.Timestamp = (ulong)Now();

            model.Notifier = NotifierModelBuilder.CreateFromAssemblyInfo();

            var currentHttpRequest = GetCurrentHttpRequest();

            if (currentHttpRequest == null)
            {
                model.Request = new RequestModel();
                model.Server  = new ServerModel();
                model.Person  = new PersonModel();
            }
            else
            {
                model.Request = RequestModelBuilder.CreateFromHttpRequest(currentHttpRequest, HttpContext.Current.Session, Configuration.ScrubParams);
                model.Server  = ServerModelBuilder.CreateFromHttpRequest(currentHttpRequest);
                model.Person  = PersonModelBuilder.CreateFromHttpRequest(currentHttpRequest);
            }

            if (requestSession != null)
            {
                foreach (var key in requestSession.Keys)
                {
                    model.Request.Session[key] = requestSession[key];
                }
            }

            if (person != null)
            {
                model.Person.Email    = person.Email ?? model.Person.Email;
                model.Person.Id       = person.Id ?? model.Person.Id;
                model.Person.Username = person.Username ?? model.Person.Username;
            }

            model.Server.GitSha = Configuration.GitSha;

            return(model);
        }
示例#3
0
        /// <summary>
        /// Create the best stub of a request that we can using the message level and body
        /// </summary>
        /// <param name="level"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        protected DataModel Create(string level, BodyModel body)
        {
            var model = new DataModel(level, body);

            model.Environment = Configuration.Environment;
            model.Platform    = Configuration.Platform;
            model.Language    = Configuration.Language;
            model.Framework   = Configuration.Framework;

            model.Timestamp = (ulong)Now();

            model.Notifier = NotifierModelBuilder.CreateFromAssemblyInfo();

            model.Request       = RequestModelBuilder.CreateFromCurrentRequest();
            model.Server        = ServerModelBuilder.CreateFromCurrentRequest();
            model.Server.GitSha = Configuration.GitSha;
            model.Person        = PersonModelBuilder.CreateFromCurrentRequest();

            return(model);
        }