GetRequest() public static method

Gets the request.
public static GetRequest ( ISentryRequestFactory factory ) : ISentryRequest
factory ISentryRequestFactory
return ISentryRequest
コード例 #1
0
        /// <summary>
        /// Prevents a default instance of the <see cref="JsonPacket"/> class from being created.
        /// </summary>
        private JsonPacket()
        {
            // Get assemblies.
            Modules = SystemUtil.GetModules();

            // The current hostname
            ServerName = Environment.MachineName;

            // Create timestamp
            TimeStamp = DateTime.UtcNow;

            // Default logger.
            Logger = "root";

            // Default error level.
            Level = ErrorLevel.Error;

            // Create a guid.
            EventID = Guid.NewGuid().ToString("n");

            // Project
            Project = "default";

            // Platform
            Platform = "csharp";

            // Get data from the HTTP request
            Request = SentryRequest.GetRequest();

            // Get the user data from the HTTP context or environment
            User = Request != null
                       ? Request.GetUser()
                       : new SentryUser(Environment.UserName);
        }