Esempio n. 1
0
 public void Save(StackExchange.Profiling.MiniProfiler profiler)
 {
     if (profiler == null)
     {
         return;
     }
     _logger.Log(_logLevel, profiler.ToJson());
 }
Esempio n. 2
0
        private static string ResultsFullPage(HttpContext context, MiniProfiler profiler)
        {
            context.Response.ContentType = "text/html";

            var template = GetResource("share.html");

            return(template.Format(new
            {
                name = profiler.Name,
                duration = profiler.DurationMilliseconds.ToString(CultureInfo.InvariantCulture),
                path = VirtualPathUtility.ToAbsolute(MiniProfiler.Settings.RouteBasePath).EnsureTrailingSlash(),
                json = MiniProfiler.ToJson(profiler),
                includes = RenderIncludes(profiler),
                version = MiniProfiler.Settings.Version
            }));
        }
Esempio n. 3
0
        private static string ResultsFullPage(HttpContext context, MiniProfiler profiler)
        {
            context.Response.ContentType = "text/html";
            if (!TryGetResource("share.html", out string template))
            {
                return(NotFound(context));
            }
            var sb = new StringBuilder(template);

            sb.Replace("{name}", profiler.Name)
            .Replace("{duration}", profiler.DurationMilliseconds.ToString(CultureInfo.InvariantCulture))
            .Replace("{path}", VirtualPathUtility.ToAbsolute(MiniProfiler.Settings.RouteBasePath).EnsureTrailingSlash())
            .Replace("{json}", profiler.ToJson(false))
            .Replace("{includes}", RenderIncludes(profiler).ToString())
            .Replace("{version}", MiniProfiler.Settings.VersionHash);
            return(sb.ToString());
        }
Esempio n. 4
0
        private string ResultsFullPage(HttpContext context, MiniProfiler profiler)
        {
            new RequestState {
                IsAuthorized = true
            }.Store(context);

            context.Response.ContentType = "text/html";
            if (!Embedded.TryGetResource("share.html", out string template))
            {
                return(NotFound(context, "Share.html was not found"));
            }
            var sb = new StringBuilder(template);

            sb.Replace("{name}", profiler.Name)
            .Replace("{duration}", profiler.DurationMilliseconds.ToString(CultureInfo.InvariantCulture))
            .Replace("{path}", BasePath.Value.EnsureTrailingSlash())
            .Replace("{json}", profiler.ToJson())
            .Replace("{includes}", profiler.RenderIncludes(context).ToString())
            .Replace("{version}", MiniProfiler.Settings.VersionHash);
            return(sb.ToString());
        }
Esempio n. 5
0
 private static string ResultsJson(HttpContext context, MiniProfiler profiler)
 {
     context.Response.ContentType = "application/json";
     return(profiler.ToJson());
 }