* Fix PageGenerator

* Generate pages on build
 * Add copyable stacktrace to error page
This commit is contained in:
ryanbrandenburg 2015-10-13 12:49:03 -07:00
parent b144f5fd7c
commit 7dac0986c2
20 changed files with 841 additions and 1241 deletions

View File

@ -5,4 +5,7 @@ var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
use-standard-lifecycle
k-standard-goals
k-standard-goals
#generatepages target='initialize'
k command='run ../Microsoft.AspNet.Diagnostics' dnxDir='src/PageGenerator'

View File

@ -46,181 +46,6 @@ using Microsoft.Extensions.Logging
public class DetailsPage : Microsoft.AspNet.Diagnostics.Views.BaseView
{
public HelperResult
#line 19 "DetailsPage.cshtml"
LogRow(LogInfo log)
{
#line default
#line hidden
return new HelperResult((__razor_helper_writer) => {
#line 20 "DetailsPage.cshtml"
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <tr>\r\n <td>");
#line 25 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td>");
#line 26 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 768), Tuple.Create("\"", 819),
Tuple.Create(Tuple.Create("", 776), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 776), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 27 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, log.Severity);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 856), Tuple.Create("\"", 873),
Tuple.Create(Tuple.Create("", 864), Tuple.Create<System.Object, System.Int32>(log.Name, 864), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 28 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, log.Name);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 906), Tuple.Create("\"", 926),
Tuple.Create(Tuple.Create("", 914), Tuple.Create<System.Object, System.Int32>(log.Message, 914), false));
WriteLiteralTo(__razor_helper_writer, " class=\"logState\" width=\"100px\">");
#line 29 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, log.Message);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 993), Tuple.Create("\"", 1015),
Tuple.Create(Tuple.Create("", 1001), Tuple.Create<System.Object, System.Int32>(log.Exception, 1001), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 30 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, log.Exception);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n </tr>\r\n");
#line 32 "DetailsPage.cshtml"
}
#line default
#line hidden
}
);
#line 33 "DetailsPage.cshtml"
}
#line default
#line hidden
public HelperResult
#line 35 "DetailsPage.cshtml"
Traverse(ScopeNode node)
{
#line default
#line hidden
return new HelperResult((__razor_helper_writer) => {
#line 36 "DetailsPage.cshtml"
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
#line default
#line hidden
#line 43 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex]));
#line default
#line hidden
#line 43 "DetailsPage.cshtml"
messageIndex++;
}
else
{
#line default
#line hidden
#line 48 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex]));
#line default
#line hidden
#line 48 "DetailsPage.cshtml"
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
#line default
#line hidden
#line 56 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(node.Messages[i]));
#line default
#line hidden
#line 56 "DetailsPage.cshtml"
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
#line default
#line hidden
#line 63 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
#line default
#line hidden
#line 63 "DetailsPage.cshtml"
}
}
#line default
#line hidden
}
);
#line 66 "DetailsPage.cshtml"
}
#line default
#line hidden
#line 10 "DetailsPage.cshtml"
public DetailsPage(DetailsPageModel model)
@ -230,6 +55,72 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
public DetailsPageModel Model { get; set; }
public HelperResult LogRow(LogInfo log)
{
return new HelperResult((writer) =>
{
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
WriteLiteralTo(writer, " <tr>\r\n <td>");
WriteTo(writer, string.Format("{0:MM/dd/yy}", log.Time));
WriteLiteralTo(writer, "</td>\r\n <td>");
WriteTo(writer, string.Format("{0:H:mm:ss}", log.Time));
var severity = log.Severity.ToString().ToLowerInvariant();
WriteLiteralTo(writer, $"</td>\r\n <td class=\"{severity}\">");
WriteTo(writer, log.Severity);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Name}\">");
WriteTo(writer, log.Name);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Message}\""+
"class=\"logState\" width=\"100px\">");
WriteTo(writer, log.Message);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Exception}\">");
WriteTo(writer, log.Exception);
WriteLiteralTo(writer, "</td>\r\n </tr>\r\n");
}
});
}
public HelperResult Traverse(ScopeNode node)
{
return new HelperResult((writer) =>
{
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
LogRow(node.Messages[messageIndex]);
messageIndex++;
}
else
{
Traverse(node.Children[childIndex]);
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
LogRow(node.Messages[i]);
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
Traverse(node.Children[i]);
}
}
});
}
#line default
#line hidden
#line hidden
@ -240,10 +131,14 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Response.ContentType = "text/html; charset=utf-8";
WriteLiteral("\r\n");
WriteLiteral("\r\n");
WriteLiteral("\r\n");
#line 84 "DetailsPage.cshtml"
Response.ContentType = "text/html";
#line default
#line hidden
WriteLiteral(@"<!DOCTYPE html>
<html>
<head>
@ -251,113 +146,19 @@ WriteTo(__razor_helper_writer, Traverse(node.Children[i]));
<title>ASP.NET Logs</title>
<script src=""http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js""></script>
<style>
body {
font-family: 'Segoe UI', Tahoma, Arial, Helvtica, sans-serif;
line-height: 1.4em;
}
h1 {
font-family: 'Segoe UI', Helvetica, sans-serif;
font-size: 2.5em;
}
td {
text-overflow: ellipsis;
overflow: hidden;
}
tr:nth-child(2n) {
background-color: #F6F6F6;
}
.critical {
background-color: red;
color: white;
}
.error {
color: red;
}
.information {
color: blue;
}
.verbose {
color: black;
}
.warning {
color: orange;
}
body {
font-size: 0.9em;
width: 90%;
margin: 0px auto;
}
h1 {
padding-bottom: 10px;
}
h2 {
font-weight: normal;
}
table {
border-spacing: 0px;
width: 100%;
border-collapse: collapse;
border: 1px solid black;
white-space: pre-wrap;
}
th {
font-family: Arial;
}
td, th {
padding: 8px;
}
#headerTable, #cookieTable {
border: none;
height: 100%;
}
#headerTd {
white-space: normal;
}
#label {
width: 20%;
border-right: 1px solid black;
}
#logs{
margin-top: 10px;
margin-bottom: 20px;
}
#logs>tbody>tr>td {
border-right: 1px dashed lightgray;
}
#logs>thead>tr>th {
border: 1px solid black;
}
<%$ include: Shared.css % > <%$ include: DetailsPage.css % >
</style>
</head>
<body>
<h1>ASP.NET Logs</h1>
");
#line 80 "DetailsPage.cshtml"
#line 99 "DetailsPage.cshtml"
#line default
#line hidden
#line 80 "DetailsPage.cshtml"
#line 99 "DetailsPage.cshtml"
var context = Model.Activity?.HttpInfo;
@ -365,14 +166,8 @@ td, th {
#line default
#line hidden
WriteLiteral("\r\n");
#line 83 "DetailsPage.cshtml"
#line default
#line hidden
#line 83 "DetailsPage.cshtml"
WriteLiteral(" ");
#line 102 "DetailsPage.cshtml"
if (context != null)
{
@ -382,35 +177,35 @@ td, th {
WriteLiteral(" <h2 id=\"requestHeader\">Request Details</h2>\r\n <table id=\"requestDe" +
"tails\">\r\n <colgroup><col id=\"label\" /><col /></colgroup>\r\n\r\n " +
" <tr>\r\n <th>Path</th>\r\n <td>");
#line 91 "DetailsPage.cshtml"
#line 110 "DetailsPage.cshtml"
Write(context.Path);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Host</th>\r\n " +
" <td>");
#line 95 "DetailsPage.cshtml"
#line 114 "DetailsPage.cshtml"
Write(context.Host);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Content Type</th>" +
"\r\n <td>");
#line 99 "DetailsPage.cshtml"
#line 118 "DetailsPage.cshtml"
Write(context.ContentType);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Method</th>\r\n " +
" <td>");
#line 103 "DetailsPage.cshtml"
#line 122 "DetailsPage.cshtml"
Write(context.Method);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Protocol</th>\r\n " +
" <td>");
#line 107 "DetailsPage.cshtml"
#line 126 "DetailsPage.cshtml"
Write(context.Protocol);
#line default
@ -429,33 +224,33 @@ td, th {
</thead>
<tbody>
");
#line 120 "DetailsPage.cshtml"
#line 139 "DetailsPage.cshtml"
#line default
#line hidden
#line 120 "DetailsPage.cshtml"
#line 139 "DetailsPage.cshtml"
foreach (var header in context.Headers)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>");
#line 123 "DetailsPage.cshtml"
Write(header.Key);
WriteLiteral(" <tr>\r\n <td>");
#line 142 "DetailsPage.cshtml"
Write(header.Key);
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 124 "DetailsPage.cshtml"
Write(string.Join(";", header.Value));
WriteLiteral("</td>\r\n <td>");
#line 143 "DetailsPage.cshtml"
Write(string.Join(";", header.Value));
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n");
#line 126 "DetailsPage.cshtml"
WriteLiteral("</td>\r\n </tr>\r\n");
#line 145 "DetailsPage.cshtml"
}
#line default
@ -464,77 +259,76 @@ td, th {
WriteLiteral(" </tbody>\r\n </table>\r\n <" +
"/td>\r\n </tr>\r\n <tr>\r\n <th>Status Code</th>\r" +
"\n <td>");
#line 133 "DetailsPage.cshtml"
#line 152 "DetailsPage.cshtml"
Write(context.StatusCode);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>User</th>\r\n " +
" <td>");
#line 137 "DetailsPage.cshtml"
#line 156 "DetailsPage.cshtml"
Write(context.User.Identity.Name);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Claims</th>\r\n " +
" <td>\r\n");
#line 142 "DetailsPage.cshtml"
#line 161 "DetailsPage.cshtml"
#line default
#line hidden
#line 142 "DetailsPage.cshtml"
#line 161 "DetailsPage.cshtml"
if (context.User.Claims.Any())
{
#line default
#line hidden
WriteLiteral(@" <table id=""claimsTable"">
<thead>
<tr>
<th>Issuer</th>
<th>Value</th>
</tr>
</thead>
<tbody>
WriteLiteral(@" <table id=""claimsTable"">
<thead>
<tr>
<th>Issuer</th>
<th>Value</th>
</tr>
</thead>
<tbody>
");
#line 152 "DetailsPage.cshtml"
#line 171 "DetailsPage.cshtml"
#line default
#line hidden
#line 152 "DetailsPage.cshtml"
foreach (var claim in context.User.Claims)
#line 171 "DetailsPage.cshtml"
foreach (var claim in context.User.Claims)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n " +
" <td>");
#line 155 "DetailsPage.cshtml"
Write(claim.Issuer);
WriteLiteral(" <tr>\r\n <td>");
#line 174 "DetailsPage.cshtml"
Write(claim.Issuer);
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 156 "DetailsPage.cshtml"
Write(claim.Value);
WriteLiteral("</td>\r\n <td>");
#line 175 "DetailsPage.cshtml"
Write(claim.Value);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n");
#line 158 "DetailsPage.cshtml"
WriteLiteral("</td>\r\n </tr>\r\n");
#line 177 "DetailsPage.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tbody>\r\n </table>\r\n");
#line 161 "DetailsPage.cshtml"
WriteLiteral(" </tbody>\r\n </table>\r\n");
#line 180 "DetailsPage.cshtml"
}
#line default
@ -542,97 +336,96 @@ td, th {
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>S" +
"cheme</th>\r\n <td>");
#line 166 "DetailsPage.cshtml"
#line 185 "DetailsPage.cshtml"
Write(context.Scheme);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Query</th>\r\n " +
" <td>");
#line 170 "DetailsPage.cshtml"
#line 189 "DetailsPage.cshtml"
Write(context.Query.Value);
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>Cookies</th>\r\n " +
" <td>\r\n");
#line 175 "DetailsPage.cshtml"
#line 194 "DetailsPage.cshtml"
#line default
#line hidden
#line 175 "DetailsPage.cshtml"
#line 194 "DetailsPage.cshtml"
if (context.Cookies.Any())
{
#line default
#line hidden
WriteLiteral(@" <table id=""cookieTable"">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
WriteLiteral(@" <table id=""cookieTable"">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
");
#line 185 "DetailsPage.cshtml"
#line 204 "DetailsPage.cshtml"
#line default
#line hidden
#line 185 "DetailsPage.cshtml"
foreach (var cookie in context.Cookies)
#line 204 "DetailsPage.cshtml"
foreach (var cookie in context.Cookies)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n " +
" <td>");
#line 188 "DetailsPage.cshtml"
Write(cookie.Key);
WriteLiteral(" <tr>\r\n <td>");
#line 207 "DetailsPage.cshtml"
Write(cookie.Key);
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 189 "DetailsPage.cshtml"
Write(string.Join(";", cookie.Value));
WriteLiteral("</td>\r\n <td>");
#line 208 "DetailsPage.cshtml"
Write(string.Join(";", cookie.Value));
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n");
#line 191 "DetailsPage.cshtml"
WriteLiteral("</td>\r\n </tr>\r\n");
#line 210 "DetailsPage.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tbody>\r\n </table>\r\n");
#line 194 "DetailsPage.cshtml"
WriteLiteral(" </tbody>\r\n </table>\r\n");
#line 213 "DetailsPage.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n");
#line 198 "DetailsPage.cshtml"
#line 217 "DetailsPage.cshtml"
}
#line default
#line hidden
WriteLiteral(" <h2>Logs</h2>\r\n <form method=\"get\">\r\n <select name=\"level\">\r\n");
#line 202 "DetailsPage.cshtml"
#line 221 "DetailsPage.cshtml"
#line default
#line hidden
#line 202 "DetailsPage.cshtml"
#line 221 "DetailsPage.cshtml"
foreach (var severity in Enum.GetValues(typeof(LogLevel)))
{
var severityInt = (int)severity;
@ -643,16 +436,17 @@ td, th {
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 6703), Tuple.Create("\"", 6723),
Tuple.Create(Tuple.Create("", 6711), Tuple.Create<System.Object, System.Int32>(severityInt, 6711), false));
BeginWriteAttribute("value", " value=\"", 7693, "\"", 7713, 1);
WriteAttributeValue("", 7701, severityInt, 7701, 12, false);
EndWriteAttribute();
WriteLiteral(" selected=\"selected\">");
#line 207 "DetailsPage.cshtml"
#line 226 "DetailsPage.cshtml"
Write(severity);
#line default
#line hidden
WriteLiteral("</option>\r\n");
#line 208 "DetailsPage.cshtml"
#line 227 "DetailsPage.cshtml"
}
else
{
@ -661,16 +455,17 @@ td, th {
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 6852), Tuple.Create("\"", 6872),
Tuple.Create(Tuple.Create("", 6860), Tuple.Create<System.Object, System.Int32>(severityInt, 6860), false));
BeginWriteAttribute("value", " value=\"", 7842, "\"", 7862, 1);
WriteAttributeValue("", 7850, severityInt, 7850, 12, false);
EndWriteAttribute();
WriteLiteral(">");
#line 211 "DetailsPage.cshtml"
#line 230 "DetailsPage.cshtml"
Write(severity);
#line default
#line hidden
WriteLiteral("</option>\r\n");
#line 212 "DetailsPage.cshtml"
#line 231 "DetailsPage.cshtml"
}
}
@ -678,8 +473,9 @@ td, th {
#line hidden
WriteLiteral(" </select>\r\n <input type=\"text\" name=\"name\"");
WriteAttribute("value", Tuple.Create(" value=\"", 6985), Tuple.Create("\"", 7018),
Tuple.Create(Tuple.Create("", 6993), Tuple.Create<System.Object, System.Int32>(Model.Options.NamePrefix, 6993), false));
BeginWriteAttribute("value", " value=\"", 7975, "\"", 8008, 1);
WriteAttributeValue("", 7983, Model.Options.NamePrefix, 7983, 25, false);
EndWriteAttribute();
WriteLiteral(@" />
<input type=""submit"" value=""filter"" />
</form>
@ -695,7 +491,7 @@ td, th {
</tr>
</thead>
");
#line 229 "DetailsPage.cshtml"
#line 248 "DetailsPage.cshtml"
Write(Traverse(Model.Activity.Root));
#line default

View File

@ -1,4 +1,4 @@
@using System
@using System
@using System.Globalization
@using System.Linq
@using Microsoft.AspNet.Diagnostics.Elm
@ -14,55 +14,75 @@
}
public DetailsPageModel Model { get; set; }
}
@helper LogRow(LogInfo log)
{
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
public HelperResult LogRow(LogInfo log)
{
<tr>
<td>@string.Format("{0:MM/dd/yy}", log.Time)</td>
<td>@string.Format("{0:H:mm:ss}", log.Time)</td>
<td class="@log.Severity.ToString().ToLowerInvariant()">@log.Severity</td>
<td title="@log.Name">@log.Name</td>
<td title="@log.Message" class="logState" width="100px">@log.Message</td>
<td title="@log.Exception">@log.Exception</td>
</tr>
return new HelperResult((writer) =>
{
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
WriteLiteralTo(writer, " <tr>\r\n <td>");
WriteTo(writer, string.Format("{0:MM/dd/yy}", log.Time));
WriteLiteralTo(writer, "</td>\r\n <td>");
WriteTo(writer, string.Format("{0:H:mm:ss}", log.Time));
var severity = log.Severity.ToString().ToLowerInvariant();
WriteLiteralTo(writer, $"</td>\r\n <td class=\"{severity}\">");
WriteTo(writer, log.Severity);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Name}\">");
WriteTo(writer, log.Name);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Message}\""+
"class=\"logState\" width=\"100px\">");
WriteTo(writer, log.Message);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Exception}\">");
WriteTo(writer, log.Exception);
WriteLiteralTo(writer, "</td>\r\n </tr>\r\n");
}
});
}
public HelperResult Traverse(ScopeNode node)
{
return new HelperResult((writer) =>
{
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
LogRow(node.Messages[messageIndex]);
messageIndex++;
}
else
{
Traverse(node.Children[childIndex]);
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
LogRow(node.Messages[i]);
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
Traverse(node.Children[i]);
}
}
});
}
}
@helper Traverse(ScopeNode node)
{
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
@LogRow(node.Messages[messageIndex])
messageIndex++;
}
else
{
@Traverse(node.Children[childIndex])
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
@LogRow(node.Messages[i])
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
@Traverse(node.Children[i])
}
}
@{
Response.ContentType = "text/html";
}
<!DOCTYPE html>
<html>
@ -71,8 +91,7 @@
<title>ASP.NET Logs</title>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js"></script>
<style>
<%$ include: Shared.css %>
<%$ include: DetailsPage.css %>
<%$ include: Shared.css % > <%$ include: DetailsPage.css % >
</style>
</head>
<body>
@ -119,10 +138,10 @@
<tbody>
@foreach (var header in context.Headers)
{
<tr>
<td>@header.Key</td>
<td>@string.Join(";", header.Value)</td>
</tr>
<tr>
<td>@header.Key</td>
<td>@string.Join(";", header.Value)</td>
</tr>
}
</tbody>
</table>
@ -141,23 +160,23 @@
<td>
@if (context.User.Claims.Any())
{
<table id="claimsTable">
<thead>
<tr>
<th>Issuer</th>
<th>Value</th>
</tr>
</thead>
<tbody>
@foreach (var claim in context.User.Claims)
<table id="claimsTable">
<thead>
<tr>
<th>Issuer</th>
<th>Value</th>
</tr>
</thead>
<tbody>
@foreach (var claim in context.User.Claims)
{
<tr>
<td>@claim.Issuer</td>
<td>@claim.Value</td>
</tr>
<tr>
<td>@claim.Issuer</td>
<td>@claim.Value</td>
</tr>
}
</tbody>
</table>
</tbody>
</table>
}
</td>
</tr>
@ -174,23 +193,23 @@
<td>
@if (context.Cookies.Any())
{
<table id="cookieTable">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
@foreach (var cookie in context.Cookies)
<table id="cookieTable">
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
@foreach (var cookie in context.Cookies)
{
<tr>
<td>@cookie.Key</td>
<td>@string.Join(";", cookie.Value)</td>
</tr>
<tr>
<td>@cookie.Key</td>
<td>@string.Join(";", cookie.Value)</td>
</tr>
}
</tbody>
</table>
</tbody>
</table>
}
</td>
</tr>

View File

@ -52,241 +52,6 @@ using Microsoft.Extensions.Logging
public class LogPage : Microsoft.AspNet.Diagnostics.Views.BaseView
{
public HelperResult
#line 21 "LogPage.cshtml"
LogRow(LogInfo log, int level) {
#line default
#line hidden
return new HelperResult((__razor_helper_writer) => {
#line 21 "LogPage.cshtml"
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <tr class=\"logRow\">\r\n <td>");
#line 26 "LogPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td>");
#line 27 "LogPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 871), Tuple.Create("\"", 888),
Tuple.Create(Tuple.Create("", 879), Tuple.Create<System.Object, System.Int32>(log.Name, 879), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 28 "LogPage.cshtml"
WriteTo(__razor_helper_writer, log.Name);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 921), Tuple.Create("\"", 972),
Tuple.Create(Tuple.Create("", 929), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 929), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 29 "LogPage.cshtml"
WriteTo(__razor_helper_writer, log.Severity);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1009), Tuple.Create("\"", 1029),
Tuple.Create(Tuple.Create("", 1017), Tuple.Create<System.Object, System.Int32>(log.Message, 1017), false));
WriteLiteralTo(__razor_helper_writer, ">\r\n");
#line 31 "LogPage.cshtml"
#line default
#line hidden
#line 31 "LogPage.cshtml"
for (var i = 0; i < level; i++)
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <span class=\"tab\"></span>\r\n");
#line 34 "LogPage.cshtml"
}
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " ");
#line 35 "LogPage.cshtml"
WriteTo(__razor_helper_writer, log.Message);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "\r\n </td>\r\n <td");
WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1232), Tuple.Create("\"", 1254),
Tuple.Create(Tuple.Create("", 1240), Tuple.Create<System.Object, System.Int32>(log.Exception, 1240), false));
WriteLiteralTo(__razor_helper_writer, ">");
#line 37 "LogPage.cshtml"
WriteTo(__razor_helper_writer, log.Exception);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</td>\r\n </tr>\r\n");
#line 39 "LogPage.cshtml"
}
#line default
#line hidden
}
);
#line 40 "LogPage.cshtml"
}
#line default
#line hidden
public HelperResult
#line 42 "LogPage.cshtml"
Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
{
#line default
#line hidden
return new HelperResult((__razor_helper_writer) => {
#line 43 "LogPage.cshtml"
// print start of scope
#line default
#line hidden
#line 45 "LogPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Message = "Beginning " + node.State,
}, level));
#line default
#line hidden
#line 51 "LogPage.cshtml"
;
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
#line default
#line hidden
#line 58 "LogPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(node.Messages[messageIndex], level));
#line default
#line hidden
#line 58 "LogPage.cshtml"
counts[node.Messages[messageIndex].Severity.ToString()]++;
messageIndex++;
}
else
{
#line default
#line hidden
#line 64 "LogPage.cshtml"
WriteTo(__razor_helper_writer, Traverse(node.Children[childIndex], level + 1, counts));
#line default
#line hidden
#line 64 "LogPage.cshtml"
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
#line default
#line hidden
#line 72 "LogPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(node.Messages[i], level));
#line default
#line hidden
#line 72 "LogPage.cshtml"
counts[node.Messages[i].Severity.ToString()]++;
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
#line default
#line hidden
#line 80 "LogPage.cshtml"
WriteTo(__razor_helper_writer, Traverse(node.Children[i], level + 1, counts));
#line default
#line hidden
#line 80 "LogPage.cshtml"
}
}
// print end of scope
#line default
#line hidden
#line 84 "LogPage.cshtml"
WriteTo(__razor_helper_writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level));
#line default
#line hidden
#line 90 "LogPage.cshtml"
;
#line default
#line hidden
}
);
#line 91 "LogPage.cshtml"
}
#line default
#line hidden
#line 11 "LogPage.cshtml"
public LogPage(LogPageModel model)
@ -296,6 +61,101 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
public LogPageModel Model { get; set; }
public HelperResult LogRow(LogInfo log, int level)
{
return new HelperResult((writer) =>
{
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
WriteLiteralTo(writer, " <tr class=\"logRow\">\r\n <td>");
WriteTo(writer, string.Format("{0:MM/dd/yy}", log.Time));
WriteLiteralTo(writer, "</td>\r\n <td>");
WriteTo(writer, string.Format("{0:H:mm:ss}", log.Time));
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Name}\">");
WriteTo(writer, log.Name);
var severity = log.Severity.ToString().ToLowerInvariant();
WriteLiteralTo(writer, $"</td>\r\n <td class=\"{severity}\">");
WriteTo(writer, log.Severity);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Message}\"> \r\n");
for (var i = 0; i < level; i++)
{
WriteLiteralTo(writer, " <span class=\"tab\"></span>\r\n");
}
WriteLiteralTo(writer, " ");
WriteTo(writer, log.Message);
WriteLiteralTo(writer, $"\r\n </td>\r\n <td title=\"{log.Exception}\">");
WriteTo(writer, log.Exception);
WriteLiteralTo(writer, "</td>\r\n </tr>\r\n");
}
});
}
public HelperResult Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
{
return new HelperResult((writer) => {
// print start of scope
WriteTo(writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Message = "Beginning " + node.State,
}, level));
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
WriteTo(writer, LogRow(node.Messages[messageIndex], level));
counts[node.Messages[messageIndex].Severity.ToString()]++;
messageIndex++;
}
else
{
WriteTo(writer, Traverse(node.Children[childIndex], level + 1, counts));
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
WriteTo(writer, LogRow(node.Messages[i], level));
counts[node.Messages[i].Severity.ToString()]++;
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
WriteTo(writer, Traverse(node.Children[i], level + 1, counts));
}
}
// print end of scope
WriteTo(writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level));
});
}
#line default
#line hidden
#line hidden
@ -306,10 +166,14 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
Response.ContentType = "text/html; charset=utf-8";
WriteLiteral("\r\n");
WriteLiteral("\r\n\r\n");
WriteLiteral("\r\n");
#line 114 "LogPage.cshtml"
Response.ContentType = "text/html";
#line default
#line hidden
WriteLiteral(@"
<!DOCTYPE html>
<html>
@ -318,155 +182,8 @@ WriteTo(__razor_helper_writer, LogRow(new LogInfo()
<title>ASP.NET Logs</title>
<script src=""//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js""></script>
<style>
body {
font-size: .813em;
white-space: nowrap;
margin: 20px;
}
col:nth-child(2n) {
background-color: #FAFAFA;
}
form {
display: inline-block;
}
h1 {
margin-left: 25px;
}
table {
margin: 0px auto;
border-collapse: collapse;
border-spacing: 0px;
table-layout: fixed;
width: 100%;
}
td, th {
padding: 4px;
}
thead {
font-size: 1em;
font-family: Arial;
}
tr {
height: 23px;
}
#requestHeader {
border-bottom: solid 1px gray;
border-top: solid 1px gray;
margin-bottom: 2px;
font-size: 1em;
line-height: 2em;
}
.collapse {
color: black;
float: right;
font-weight: normal;
width: 1em;
}
.date, .time {
width: 70px;
}
.logHeader {
border-bottom: 1px solid lightgray;
color: gray;
text-align: left;
}
.logState {
text-overflow: ellipsis;
overflow: hidden;
}
.logTd {
border-left: 1px solid gray;
padding: 0px;
}
.logs {
width: 80%;
}
.logRow:hover {
background-color: #D6F5FF;
}
.requestRow>td {
border-bottom: solid 1px gray;
}
.severity {
width: 80px;
}
.summary {
color: black;
line-height: 1.8em;
}
.summary>th {
font-weight: normal;
}
.tab {
margin-left: 30px;
}
#viewOptions {
margin: 20px;
}
#viewOptions > * {
margin: 5px;
}
body {
font-family: 'Segoe UI', Tahoma, Arial, Helvtica, sans-serif;
line-height: 1.4em;
}
h1 {
font-family: 'Segoe UI', Helvetica, sans-serif;
font-size: 2.5em;
}
td {
text-overflow: ellipsis;
overflow: hidden;
}
tr:nth-child(2n) {
background-color: #F6F6F6;
}
.critical {
background-color: red;
color: white;
}
.error {
color: red;
}
.information {
color: blue;
}
.verbose {
color: black;
}
.warning {
color: orange;
}
body {\r\n font-size: .813em;\r\n white-space: nowrap;\r\n margin: 20px;\r\n}\r\n\r\ncol:nth-child(2n) {\r\n background-color: #FAFAFA;\r\n}\r\n\r\nform { \r\n display: inline-block; \r\n}\r\n\r\nh1 {\r\n margin-left: 25px;\r\n}\r\n\r\ntable {\r\n margin: 0px auto;\r\n border-collapse: collapse;\r\n border-spacing: 0px;\r\n table-layout: fixed;\r\n width: 100%;\r\n}\r\n\r\ntd, th {\r\n padding: 4px;\r\n}\r\n\r\nthead {\r\n font-size: 1em;\r\n font-family: Arial;\r\n}\r\n\r\ntr {\r\n height: 23px;\r\n}\r\n\r\n#requestHeader {\r\n border-bottom: solid 1px gray;\r\n border-top: solid 1px gray;\r\n margin-bottom: 2px;\r\n font-size: 1em;\r\n line-height: 2em;\r\n}\r\n\r\n.collapse {\r\n color: black;\r\n float: right;\r\n font-weight: normal;\r\n width: 1em;\r\n}\r\n\r\n.date, .time {\r\n width: 70px; \r\n}\r\n\r\n.logHeader {\r\n border-bottom: 1px solid lightgray;\r\n color: gray;\r\n text-align: left;\r\n}\r\n\r\n.logState {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n}\r\n\r\n.logTd {\r\n border-left: 1px solid gray;\r\n padding: 0px;\r\n}\r\n\r\n.logs {\r\n width: 80%;\r\n}\r\n\r\n.logRow:hover {\r\n background-color: #D6F5FF;\r\n}\r\n\r\n.requestRow>td {\r\n border-bottom: solid 1px gray;\r\n}\r\n\r\n.severity {\r\n width: 80px;\r\n}\r\n\r\n.summary {\r\n color: black;\r\n line-height: 1.8em;\r\n}\r\n\r\n.summary>th {\r\n font-weight: normal;\r\n}\r\n\r\n.tab {\r\n margin-left: 30px;\r\n}\r\n\r\n#viewOptions {\r\n margin: 20px;\r\n}\r\n\r\n#viewOptions > * {\r\n margin: 5px;\r\n}
body {\r\n font-family: 'Segoe UI', Tahoma, Arial, Helvtica, sans-serif;\r\n line-height: 1.4em;\r\n}\r\n\r\nh1 {\r\n font-family: 'Segoe UI', Helvetica, sans-serif;\r\n font-size: 2.5em;\r\n}\r\n\r\ntd {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n}\r\n\r\ntr:nth-child(2n) {\r\n background-color: #F6F6F6;\r\n}\r\n\r\n.critical {\r\n background-color: red;\r\n color: white;\r\n}\r\n\r\n.error {\r\n color: red;\r\n}\r\n\r\n.information {\r\n color: blue;\r\n}\r\n\r\n.verbose {\r\n color: black;\r\n}\r\n\r\n.warning {\r\n color: orange;\r\n}
</style>
</head>
<body>
@ -474,13 +191,13 @@ tr:nth-child(2n) {
<form id=""viewOptions"" method=""get"">
<select name=""level"">
");
#line 108 "LogPage.cshtml"
#line 133 "LogPage.cshtml"
#line default
#line hidden
#line 108 "LogPage.cshtml"
#line 133 "LogPage.cshtml"
foreach (var severity in Enum.GetValues(typeof(LogLevel)))
{
var severityInt = (int)severity;
@ -491,16 +208,17 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 3500), Tuple.Create("\"", 3520),
Tuple.Create(Tuple.Create("", 3508), Tuple.Create<System.Object, System.Int32>(severityInt, 3508), false));
BeginWriteAttribute("value", " value=\"", 4908, "\"", 4928, 1);
WriteAttributeValue("", 4916, severityInt, 4916, 12, false);
EndWriteAttribute();
WriteLiteral(" selected=\"selected\">");
#line 113 "LogPage.cshtml"
#line 138 "LogPage.cshtml"
Write(severity);
#line default
#line hidden
WriteLiteral("</option>\r\n");
#line 114 "LogPage.cshtml"
#line 139 "LogPage.cshtml"
}
else
{
@ -509,16 +227,17 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 3649), Tuple.Create("\"", 3669),
Tuple.Create(Tuple.Create("", 3657), Tuple.Create<System.Object, System.Int32>(severityInt, 3657), false));
BeginWriteAttribute("value", " value=\"", 5057, "\"", 5077, 1);
WriteAttributeValue("", 5065, severityInt, 5065, 12, false);
EndWriteAttribute();
WriteLiteral(">");
#line 117 "LogPage.cshtml"
#line 142 "LogPage.cshtml"
Write(severity);
#line default
#line hidden
WriteLiteral("</option>\r\n");
#line 118 "LogPage.cshtml"
#line 143 "LogPage.cshtml"
}
}
@ -526,8 +245,9 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" </select>\r\n <input type=\"text\" name=\"name\"");
WriteAttribute("value", Tuple.Create(" value=\"", 3782), Tuple.Create("\"", 3815),
Tuple.Create(Tuple.Create("", 3790), Tuple.Create<System.Object, System.Int32>(Model.Options.NamePrefix, 3790), false));
BeginWriteAttribute("value", " value=\"", 5190, "\"", 5223, 1);
WriteAttributeValue("", 5198, Model.Options.NamePrefix, 5198, 25, false);
EndWriteAttribute();
WriteLiteral(@" />
<input type=""submit"" value=""filter"" />
</form>
@ -553,13 +273,13 @@ tr:nth-child(2n) {
<col />
</colgroup>
");
#line 145 "LogPage.cshtml"
#line 170 "LogPage.cshtml"
#line default
#line hidden
#line 145 "LogPage.cshtml"
#line 170 "LogPage.cshtml"
foreach (var activity in Model.Activities.Reverse())
{
@ -567,13 +287,13 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <tbody>\r\n <tr class=\"requestRow\">\r\n");
#line 149 "LogPage.cshtml"
#line 174 "LogPage.cshtml"
#line default
#line hidden
#line 149 "LogPage.cshtml"
#line 174 "LogPage.cshtml"
var activityPath = Model.Path.Value + "/" + activity.Id;
if (activity.HttpInfo != null)
@ -583,36 +303,38 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" \t<td><a");
WriteAttribute("href", Tuple.Create(" href=\"", 4879), Tuple.Create("\"", 4899),
Tuple.Create(Tuple.Create("", 4886), Tuple.Create<System.Object, System.Int32>(activityPath, 4886), false));
WriteAttribute("title", Tuple.Create(" title=\"", 4900), Tuple.Create("\"", 4931),
Tuple.Create(Tuple.Create("", 4908), Tuple.Create<System.Object, System.Int32>(activity.HttpInfo.Path, 4908), false));
BeginWriteAttribute("href", " href=\"", 6287, "\"", 6307, 1);
WriteAttributeValue("", 6294, activityPath, 6294, 13, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 6308, "\"", 6339, 1);
WriteAttributeValue("", 6316, activity.HttpInfo.Path, 6316, 23, false);
EndWriteAttribute();
WriteLiteral(">");
#line 153 "LogPage.cshtml"
#line 178 "LogPage.cshtml"
Write(activity.HttpInfo.Path);
#line default
#line hidden
WriteLiteral("</a></td>\r\n <td>");
#line 154 "LogPage.cshtml"
#line 179 "LogPage.cshtml"
Write(activity.HttpInfo.Method);
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 155 "LogPage.cshtml"
#line 180 "LogPage.cshtml"
Write(activity.HttpInfo.Host);
#line default
#line hidden
WriteLiteral("</td>\r\n <td>");
#line 156 "LogPage.cshtml"
#line 181 "LogPage.cshtml"
Write(activity.HttpInfo.StatusCode);
#line default
#line hidden
WriteLiteral("</td>\r\n");
#line 157 "LogPage.cshtml"
#line 182 "LogPage.cshtml"
}
else if (activity.RepresentsScope)
{
@ -621,18 +343,20 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <td colspan=\"4\"><a");
WriteAttribute("href", Tuple.Create(" href=\"", 5321), Tuple.Create("\"", 5341),
Tuple.Create(Tuple.Create("", 5328), Tuple.Create<System.Object, System.Int32>(activityPath, 5328), false));
WriteAttribute("title", Tuple.Create(" title=\"", 5342), Tuple.Create("\"", 5370),
Tuple.Create(Tuple.Create("", 5350), Tuple.Create<System.Object, System.Int32>(activity.Root.State, 5350), false));
BeginWriteAttribute("href", " href=\"", 6729, "\"", 6749, 1);
WriteAttributeValue("", 6736, activityPath, 6736, 13, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 6750, "\"", 6778, 1);
WriteAttributeValue("", 6758, activity.Root.State, 6758, 20, false);
EndWriteAttribute();
WriteLiteral(">");
#line 160 "LogPage.cshtml"
#line 185 "LogPage.cshtml"
Write(activity.Root.State);
#line default
#line hidden
WriteLiteral("</a></td>\r\n");
#line 161 "LogPage.cshtml"
#line 186 "LogPage.cshtml"
}
else
{
@ -641,18 +365,18 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <td colspan=\"4\"><a");
WriteAttribute("href", Tuple.Create(" href=\"", 5533), Tuple.Create("\"", 5553),
Tuple.Create(Tuple.Create("", 5540), Tuple.Create<System.Object, System.Int32>(activityPath, 5540), false));
BeginWriteAttribute("href", " href=\"", 6941, "\"", 6961, 1);
WriteAttributeValue("", 6948, activityPath, 6948, 13, false);
EndWriteAttribute();
WriteLiteral(">Non-scope Log</a></td>\r\n");
#line 165 "LogPage.cshtml"
#line 190 "LogPage.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
<td class=""logTd"">
WriteLiteral(@" <td class=""logTd"">
<table class=""logTable"">
<thead class=""logHeader"">
<tr class=""headerRow"">
@ -665,13 +389,13 @@ tr:nth-child(2n) {
</tr>
</thead>
");
#line 179 "LogPage.cshtml"
#line 204 "LogPage.cshtml"
#line default
#line hidden
#line 179 "LogPage.cshtml"
#line 204 "LogPage.cshtml"
var counts = new Dictionary<string, int>();
counts["Critical"] = 0;
@ -684,14 +408,14 @@ tr:nth-child(2n) {
#line default
#line hidden
WriteLiteral("\r\n <tbody class=\"logBody\">\r\n");
#line 188 "LogPage.cshtml"
WriteLiteral(" <tbody class=\"logBody\">\r\n");
#line 213 "LogPage.cshtml"
#line default
#line hidden
#line 188 "LogPage.cshtml"
#line 213 "LogPage.cshtml"
if (!activity.RepresentsScope)
{
// message not within a scope
@ -701,12 +425,12 @@ tr:nth-child(2n) {
#line default
#line hidden
#line 192 "LogPage.cshtml"
#line 217 "LogPage.cshtml"
Write(LogRow(logInfo, 0));
#line default
#line hidden
#line 192 "LogPage.cshtml"
#line 217 "LogPage.cshtml"
counts[logInfo.Severity.ToString()] = 1;
}
@ -717,12 +441,12 @@ tr:nth-child(2n) {
#line default
#line hidden
#line 197 "LogPage.cshtml"
#line 222 "LogPage.cshtml"
Write(Traverse(activity.Root, 0, counts));
#line default
#line hidden
#line 197 "LogPage.cshtml"
#line 222 "LogPage.cshtml"
}
@ -732,19 +456,19 @@ tr:nth-child(2n) {
WriteLiteral(" </tbody>\r\n <tbody class=\"s" +
"ummary\">\r\n <tr class=\"logRow\">\r\n " +
" <td>");
#line 202 "LogPage.cshtml"
#line 227 "LogPage.cshtml"
Write(activity.Time.ToString("MM-dd-yyyy HH:mm:ss"));
#line default
#line hidden
WriteLiteral("</td>\r\n");
#line 203 "LogPage.cshtml"
#line 228 "LogPage.cshtml"
#line default
#line hidden
#line 203 "LogPage.cshtml"
#line 228 "LogPage.cshtml"
foreach (var kvp in counts)
{
if (string.Equals("Verbose", kvp.Key)) {
@ -753,19 +477,19 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <td>");
#line 206 "LogPage.cshtml"
#line 231 "LogPage.cshtml"
Write(kvp.Value);
#line default
#line hidden
WriteLiteral(" ");
#line 206 "LogPage.cshtml"
#line 231 "LogPage.cshtml"
Write(kvp.Key);
#line default
#line hidden
WriteLiteral("<span class=\"collapse\">v</span></td>\r\n");
#line 207 "LogPage.cshtml"
#line 232 "LogPage.cshtml"
}
else
{
@ -774,19 +498,19 @@ tr:nth-child(2n) {
#line hidden
WriteLiteral(" <td>");
#line 210 "LogPage.cshtml"
#line 235 "LogPage.cshtml"
Write(kvp.Value);
#line default
#line hidden
WriteLiteral(" ");
#line 210 "LogPage.cshtml"
#line 235 "LogPage.cshtml"
Write(kvp.Key);
#line default
#line hidden
WriteLiteral("</td>\r\n");
#line 211 "LogPage.cshtml"
#line 236 "LogPage.cshtml"
}
}
@ -796,7 +520,7 @@ tr:nth-child(2n) {
WriteLiteral(" </tr>\r\n </tbody>\r\n " +
" </table>\r\n </td>\r\n </tr>\r\n" +
" </tbody>\r\n");
#line 219 "LogPage.cshtml"
#line 244 "LogPage.cshtml"
}
#line default

View File

@ -1,4 +1,4 @@
@using System
@using System
@using System.Collections.Generic
@using System.Globalization
@using System.Linq
@ -15,79 +15,104 @@
}
public LogPageModel Model { get; set; }
}
@* writes one log row indented by the given level *@
@helper LogRow(LogInfo log, int level) {
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
public HelperResult LogRow(LogInfo log, int level)
{
<tr class="logRow">
<td>@string.Format("{0:MM/dd/yy}", log.Time)</td>
<td>@string.Format("{0:H:mm:ss}", log.Time)</td>
<td title="@log.Name">@log.Name</td>
<td class="@log.Severity.ToString().ToLowerInvariant()">@log.Severity</td>
<td title="@log.Message">
@for (var i = 0; i < level; i++)
return new HelperResult((writer) =>
{
if (log.Severity >= Model.Options.MinLevel &&
(string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
{
WriteLiteralTo(writer, " <tr class=\"logRow\">\r\n <td>");
WriteTo(writer, string.Format("{0:MM/dd/yy}", log.Time));
WriteLiteralTo(writer, "</td>\r\n <td>");
WriteTo(writer, string.Format("{0:H:mm:ss}", log.Time));
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Name}\">");
WriteTo(writer, log.Name);
var severity = log.Severity.ToString().ToLowerInvariant();
WriteLiteralTo(writer, $"</td>\r\n <td class=\"{severity}\">");
WriteTo(writer, log.Severity);
WriteLiteralTo(writer, $"</td>\r\n <td title=\"{log.Message}\"> \r\n");
for (var i = 0; i < level; i++)
{
<span class="tab"></span>
WriteLiteralTo(writer, " <span class=\"tab\"></span>\r\n");
}
@log.Message
</td>
<td title="@log.Exception">@log.Exception</td>
</tr>
WriteLiteralTo(writer, " ");
WriteTo(writer, log.Message);
WriteLiteralTo(writer, $"\r\n </td>\r\n <td title=\"{log.Exception}\">");
WriteTo(writer, log.Exception);
WriteLiteralTo(writer, "</td>\r\n </tr>\r\n");
}
});
}
public HelperResult Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
{
return new HelperResult((writer) => {
// print start of scope
WriteTo(writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Message = "Beginning " + node.State,
}, level));
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
WriteTo(writer, LogRow(node.Messages[messageIndex], level));
counts[node.Messages[messageIndex].Severity.ToString()]++;
messageIndex++;
}
else
{
WriteTo(writer, Traverse(node.Children[childIndex], level + 1, counts));
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
WriteTo(writer, LogRow(node.Messages[i], level));
counts[node.Messages[i].Severity.ToString()]++;
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
WriteTo(writer, Traverse(node.Children[i], level + 1, counts));
}
}
// print end of scope
WriteTo(writer, LogRow(new LogInfo()
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level));
});
}
}
@helper Traverse(ScopeNode node, int level, Dictionary<string, int> counts)
{
// print start of scope
@LogRow(new LogInfo()
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Message = "Beginning " + node.State,
}, level);
var messageIndex = 0;
var childIndex = 0;
while (messageIndex < node.Messages.Count && childIndex < node.Children.Count)
{
if (node.Messages[messageIndex].Time < node.Children[childIndex].StartTime)
{
@LogRow(node.Messages[messageIndex], level)
counts[node.Messages[messageIndex].Severity.ToString()]++;
messageIndex++;
}
else
{
@Traverse(node.Children[childIndex], level + 1, counts)
childIndex++;
}
}
if (messageIndex < node.Messages.Count)
{
for (var i = messageIndex; i < node.Messages.Count; i++)
{
@LogRow(node.Messages[i], level)
counts[node.Messages[i].Severity.ToString()]++;
}
}
else
{
for (var i = childIndex; i < node.Children.Count; i++)
{
@Traverse(node.Children[i], level + 1, counts)
}
}
// print end of scope
@LogRow(new LogInfo()
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level);
@{
Response.ContentType = "text/html";
}
<!DOCTYPE html>

View File

@ -9,7 +9,6 @@
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
@ -17,5 +16,6 @@
"System.Threading": "4.0.11-beta-*"
}
}
}
},
"compileExclude": ["Views/*.cshtml"]
}

View File

@ -74,7 +74,6 @@ using Microsoft.AspNet.Diagnostics.Entity.Views
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral("<!DOCTYPE html>\r\n\r\n<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r" +
"\n <meta charset=\"utf-8\" />\r\n <title>Internal Server Error</title>\r\n <st" +
"yle>\r\n body {\r\n font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;\r\n font-size: .813em;\r\n line-height: 1.4em;\r\n color: #222;\r\n}\r\n\r\nh1, h2, h3, h4, h5 {\r\n font-weight: 100;\r\n}\r\n\r\nh1 {\r\n color: #44525e;\r\n margin: 15px 0 15px 0;\r\n}\r\n\r\nh2 {\r\n margin: 10px 5px 0 0;\r\n}\r\n\r\nh3 {\r\n color: #363636;\r\n margin: 5px 5px 0 0;\r\n}\r\n\r\ncode {\r\n font-family: Consolas, \"Courier New\", courier, monospace;\r\n}\r\n\r\na {\r\n color: #1ba1e2;\r\n text-decoration: none;\r\n}\r\n\r\n a:hover {\r\n color: #13709e;\r\n text-decoration: underline;\r\n }\r\n\r\nhr {\r\n border: 1px #ddd solid;\r\n}\r\n\r\nbody .titleerror {\r\n padding: 3px;\r\n}\r\n\r\n#applyMigrations {\r\n font-size: 14px;\r\n background: #44c5f2;\r\n color: #ffffff;\r\n display: inline-block;\r\n padding: 6px 12px;\r\n margin-bottom: 0;\r\n font-weight: normal;\r\n text-align: center;\r\n white-space: nowrap;\r\n vertical-align: middle;\r\n cursor: pointer;\r\n border: 1px solid transparent;\r\n}\r\n\r\n #applyMigrations:disabled {\r\n background-color: #a9e4f9;\r\n border-color: #44c5f2;\r\n }\r\n\r\n.error {\r\n color: red;\r\n}\r\n\r\n.expanded {\r\n display: block;\r\n}\r\n\r\n.collapsed {\r\n display: none;\r\n}\r\n\r\n ");

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
@using System.Globalization
@using System.Linq
@using System.Net
@using Views
@using Microsoft.AspNet.Diagnostics
@functions
{
public CompilationErrorPageModel Model { get; set; }

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,8 @@
@using System.Globalization
@using System.Linq
@using System.Net
@using Views
@using Microsoft.AspNet.Diagnostics.Views
@using Microsoft.AspNet.Diagnostics
@functions
{
public ErrorPage(ErrorPageModel model)
@ -127,6 +128,17 @@
}
</ul>
</li>
<li>
<br/>
<div class="rawExceptionBlock">
<div>
<a href="#" id="rawExceptionButton">Show raw exception details</a>
</div>
<div id="rawException" style="display:none">
<pre>@errorDetail.Error.ToString()</pre>
</div>
</div>
</li>
}
</ul>
</div>

View File

@ -169,6 +169,12 @@
$(".page").hide();
$("#stackpage").show();
$("#rawExceptionButton").click(function () {
var div = document.getElementById('rawException');
div.style.display = 'inline-block';
div.scrollIntoView(true);
});
$(".frame")
.click(function () {
frame(this);

View File

@ -66,9 +66,10 @@ using Microsoft.Dnx.Runtime;
#line default
#line hidden
WriteLiteral("\r\n<!DOCTYPE html>\r\n<html");
WriteAttribute("lang", Tuple.Create(" lang=\"", 429), Tuple.Create("\"", 490),
Tuple.Create(Tuple.Create("", 436), Tuple.Create<System.Object, System.Int32>(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, 436), false));
WriteLiteral("<!DOCTYPE html>\r\n<html");
BeginWriteAttribute("lang", " lang=\"", 429, "\"", 490, 1);
WriteAttributeValue("", 436, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, 436, 54, false);
EndWriteAttribute();
WriteLiteral(" xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <meta charset=\"utf-8\" />\r\n " +
" <title>");
#line 24 "RuntimeInfoPage.cshtml"
@ -198,13 +199,7 @@ using Microsoft.Dnx.Runtime;
#line default
#line hidden
WriteLiteral("\r\n");
#line 56 "RuntimeInfoPage.cshtml"
#line default
#line hidden
WriteLiteral(" ");
#line 56 "RuntimeInfoPage.cshtml"
foreach (var package in Model.References.OrderBy(package => package.Name.ToLowerInvariant()))
{
@ -213,8 +208,9 @@ using Microsoft.Dnx.Runtime;
#line hidden
WriteLiteral(" <tr");
WriteAttribute("class", Tuple.Create(" class=\"", 2209), Tuple.Create("\"", 2237),
Tuple.Create(Tuple.Create("", 2217), Tuple.Create<System.Object, System.Int32>(even?"even":"odd", 2217), false));
BeginWriteAttribute("class", " class=\"", 2209, "\"", 2237, 1);
WriteAttributeValue("", 2217, even?"even":"odd", 2217, 20, false);
EndWriteAttribute();
WriteLiteral(">\r\n <td>");
#line 59 "RuntimeInfoPage.cshtml"
Write(package.Name);

View File

@ -4,35 +4,30 @@ namespace Microsoft.AspNet.Diagnostics.Views
{
public class AttributeValue
{
public AttributeValue(Tuple<string, int> prefix, Tuple<object, int> value, bool literal)
public AttributeValue(string prefix, object value, bool literal)
{
Prefix = prefix;
Value = value;
Literal = literal;
}
public Tuple<string, int> Prefix { get; }
public string Prefix { get; }
public Tuple<object, int> Value { get; }
public object Value { get; }
public bool Literal { get; }
public static AttributeValue FromTuple(Tuple<Tuple<string, int>, Tuple<object, int>, bool> value)
public static AttributeValue FromTuple(Tuple<string, object, bool> value)
{
return new AttributeValue(value.Item1, value.Item2, value.Item3);
}
public static AttributeValue FromTuple(Tuple<Tuple<string, int>, Tuple<string, int>, bool> value)
public static AttributeValue FromTuple(Tuple<string, string, bool> value)
{
return new AttributeValue(value.Item1, new Tuple<object, int>(value.Item2.Item1, value.Item2.Item2), value.Item3);
return new AttributeValue(value.Item1, value.Item2, value.Item3);
}
public static implicit operator AttributeValue(Tuple<Tuple<string, int>, Tuple<object, int>, bool> value)
{
return FromTuple(value);
}
public static implicit operator AttributeValue(Tuple<Tuple<string, int>, Tuple<string, int>, bool> value)
public static implicit operator AttributeValue(Tuple<string, object, bool> value)
{
return FromTuple(value);
}

View File

@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@ -81,40 +83,38 @@ namespace Microsoft.AspNet.Diagnostics.Views
WriteLiteralTo(Output, value);
}
/// <summary>
/// Writes the given attribute to the output
/// </summary>
/// <param name="name">The name of the attribute to write</param>
/// <param name="leader">The value and position of the prefix</param>
/// <param name="trailer">The value and position of the suffix</param>
/// <param name="values">The <see cref="AttributeValue"/>s to write.</param>
protected void WriteAttribute(
string name,
Tuple<string, int> leader,
Tuple<string, int> trailer,
params AttributeValue[] values)
private List<string> AttributeValues { get; set; }
protected void WriteAttributeValue(string thingy, int startPostion, object value, int endValue, int dealyo, bool yesno)
{
if (name == null)
if (AttributeValues == null)
{
throw new ArgumentNullException(nameof(name));
AttributeValues = new List<string>();
}
if (leader == null)
{
throw new ArgumentNullException(nameof(leader));
}
AttributeValues.Add(value.ToString());
}
if (trailer == null)
{
throw new ArgumentNullException(nameof(trailer));
}
private string AttributeEnding { get; set; }
WriteAttributeTo(
Output,
name,
leader,
trailer,
values);
protected void BeginWriteAttribute(string name, string begining, int startPosition, string ending, int endPosition, int thingy)
{
Debug.Assert(string.IsNullOrEmpty(AttributeEnding));
Output.Write(begining);
AttributeEnding = ending;
}
protected void EndWriteAttribute()
{
Debug.Assert(!string.IsNullOrEmpty(AttributeEnding));
var attributes = string.Join(" ", AttributeValues);
Output.Write(attributes);
AttributeValues = null;
Output.Write(AttributeEnding);
AttributeEnding = null;
}
/// <summary>
@ -122,14 +122,14 @@ namespace Microsoft.AspNet.Diagnostics.Views
/// </summary>
/// <param name="writer">The <see cref="TextWriter"/> instance to write to.</param>
/// <param name="name">The name of the attribute to write</param>
/// <param name="leader">The value and position of the prefix</param>
/// <param name="trailer">The value and position of the suffix</param>
/// <param name="leader">The value of the prefix</param>
/// <param name="trailer">The value of the suffix</param>
/// <param name="values">The <see cref="AttributeValue"/>s to write.</param>
protected void WriteAttributeTo(
TextWriter writer,
string name,
Tuple<string, int> leader,
Tuple<string, int> trailer,
string leader,
string trailer,
params AttributeValue[] values)
{
if (writer == null)
@ -153,19 +153,19 @@ namespace Microsoft.AspNet.Diagnostics.Views
}
WriteLiteralTo(writer, leader.Item1);
WriteLiteralTo(writer, leader);
foreach (var value in values)
{
WriteLiteralTo(writer, value.Prefix.Item1);
WriteLiteralTo(writer, value.Prefix);
// The special cases here are that the value we're writing might already be a string, or that the
// value might be a bool. If the value is the bool 'true' we want to write the attribute name
// instead of the string 'true'. If the value is the bool 'false' we don't want to write anything.
// Otherwise the value is another object (perhaps an HtmlString) and we'll ask it to format itself.
string stringValue;
if (value.Value.Item1 is bool)
if (value.Value is bool)
{
if ((bool)value.Value.Item1)
if ((bool)value.Value)
{
stringValue = name;
}
@ -176,7 +176,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
}
else
{
stringValue = value.Value.Item1 as string;
stringValue = value.Value as string;
}
// Call the WriteTo(string) overload when possible
@ -186,7 +186,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
}
else if (value.Literal)
{
WriteLiteralTo(writer, value.Value.Item1);
WriteLiteralTo(writer, value.Value);
}
else if (stringValue != null)
{
@ -194,10 +194,10 @@ namespace Microsoft.AspNet.Diagnostics.Views
}
else
{
WriteTo(writer, value.Value.Item1);
WriteTo(writer, value.Value);
}
}
WriteLiteralTo(writer, trailer.Item1);
WriteLiteralTo(writer, trailer);
}
/// <summary>

View File

@ -3,6 +3,12 @@ namespace Microsoft.AspNet.Diagnostics.Views
#line 1 "WelcomePage.cshtml"
using System
#line default
#line hidden
;
#line 2 "WelcomePage.cshtml"
using Microsoft.AspNet.Diagnostics
#line default
#line hidden
;
@ -18,18 +24,19 @@ using System
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
#line 2 "WelcomePage.cshtml"
#line 3 "WelcomePage.cshtml"
Response.ContentType = "text/html";
#line default
#line hidden
WriteLiteral("\r\n<!DOCTYPE html>\r\n<html");
WriteAttribute("lang", Tuple.Create(" lang=\"", 85), Tuple.Create("\"", 167),
Tuple.Create(Tuple.Create("", 92), Tuple.Create<System.Object, System.Int32>(System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, 92), false));
WriteLiteral("<!DOCTYPE html>\r\n<html");
BeginWriteAttribute("lang", " lang=\"", 122, "\"", 204, 1);
WriteAttributeValue("", 129, System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, 129, 75, false);
EndWriteAttribute();
WriteLiteral(">\r\n<head>\r\n <meta charset=\"utf-8\" />\r\n <title>");
#line 9 "WelcomePage.cshtml"
#line 10 "WelcomePage.cshtml"
Write(Resources.WelcomeTitle);
#line default
@ -125,10 +132,12 @@ using System
"vYX9jUUMx527ToWE9OIyjkugUfV4aXlbl5gXcZkyj3/vwj9zmVZIyH+CWS+H3jdYGq0j8XAimTAAAAAA" +
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHL0rwADANq3ok68n5UR" +
"AAAAAElFTkSuQmCC\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 7462), Tuple.Create("\"", 7530),
Tuple.Create(Tuple.Create("", 7489), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 7489), false));
WriteAttribute("title", Tuple.Create(" title=\"", 7531), Tuple.Create("\"", 7580),
Tuple.Create(Tuple.Create("", 7539), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 7539), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 7499, "\"", 7567, 1);
WriteAttributeValue("", 7526, Resources.WelcomePageImageText_LightBulb, 7526, 41, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 7568, "\"", 7617, 1);
WriteAttributeValue("", 7576, Resources.WelcomePageImageText_LightBulb, 7576, 41, false);
EndWriteAttribute();
WriteLiteral(" width=\"274\" height=\"274\" /></div>\r\n <div class=\"browser\" style=\"opaci" +
"ty: 1; visible: true;\">\r\n <img src=\"data:image/png;base64,iVBORw0" +
"KGgoAAAANSUhEUgAAAYAAAAExCAYAAAB1UXVvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR" +
@ -243,10 +252,12 @@ using System
"A4CdbIgD/wnkAAPCL77726jURgJucCgAAr0jq/lEGsMX5AADwhr9PBCBuA6T4X+V8AAB4w9WjDkB4hS4" +
"AAMALXokn/reOBeCwC/ij+HGLcwMAMFj+Kq73f3n0P6eP/nHj+k831tdf+F78z0n8uBI/znGuAAAGwbX" +
"48c24+P9N+oP/L8AAx5G6SMzC+fMAAAAASUVORK5CYII=\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 16668), Tuple.Create("\"", 16735),
Tuple.Create(Tuple.Create("", 16696), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_Browser, 16696), false));
WriteAttribute("title", Tuple.Create(" title=\"", 16736), Tuple.Create("\"", 16783),
Tuple.Create(Tuple.Create("", 16744), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_Browser, 16744), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 16705, "\"", 16772, 1);
WriteAttributeValue("", 16733, Resources.WelcomePageImageText_Browser, 16733, 39, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 16773, "\"", 16820, 1);
WriteAttributeValue("", 16781, Resources.WelcomePageImageText_Browser, 16781, 39, false);
EndWriteAttribute();
WriteLiteral(" width=\"384\" height=\"305\" /><div>:-)</div>\r\n </div>\r\n <div " +
"class=\"light second\">\r\n <img src=\"data:image/png;base64,iVBORw0KG" +
"goAAAANSUhEUgAAARIAAAESCAYAAAAxN1ojAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c" +
@ -328,10 +339,12 @@ using System
"wORwOJi6ahQRCybiSWWvopjoKmDZikiAY+JZUOlsmEotYg0hnnqYIgWkUD9cpG5KusqlTXdQkwvIxXFc" +
"EwaQ6SBSCCOBLOiclnX/70xJpl1t/ykOZHC57E/X+nnTbZ9EoEgC4DE044mHoCJ/F+AAQAgl3zNeDGxu" +
"QAAAABJRU5ErkJggg==\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 23205), Tuple.Create("\"", 23273),
Tuple.Create(Tuple.Create("", 23232), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 23232), false));
WriteAttribute("title", Tuple.Create(" title=\"", 23274), Tuple.Create("\"", 23323),
Tuple.Create(Tuple.Create("", 23282), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 23282), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 23242, "\"", 23310, 1);
WriteAttributeValue("", 23269, Resources.WelcomePageImageText_LightBulb, 23269, 41, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 23311, "\"", 23360, 1);
WriteAttributeValue("", 23319, Resources.WelcomePageImageText_LightBulb, 23319, 41, false);
EndWriteAttribute();
WriteLiteral(" width=\"274\" height=\"274\" /></div>\r\n <div class=\"bulb\">\r\n " +
" <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVoAAAKSCAYAAACTAhMyA" +
"AAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54b" +
@ -431,10 +444,12 @@ using System
"RBaAKEFEFoAhBZAaAGE1hAACC2A0AIgtABCCyC0AAgtgNACCC0AQgsgtAAILYDQAggtAEILILQAQguA0" +
"AIILYDQAiC0AEILgNACCC2A0AIgtABCCyC0AAgtgNACMCcvisIoACT0fwEGAL+BBlr+j4JHAAAAAElFT" +
"kSuQmCC\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 31173), Tuple.Create("\"", 31242),
Tuple.Create(Tuple.Create("", 31201), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 31201), false));
WriteAttribute("title", Tuple.Create(" title=\"", 31243), Tuple.Create("\"", 31292),
Tuple.Create(Tuple.Create("", 31251), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LightBulb, 31251), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 31210, "\"", 31279, 1);
WriteAttributeValue("", 31238, Resources.WelcomePageImageText_LightBulb, 31238, 41, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 31280, "\"", 31329, 1);
WriteAttributeValue("", 31288, Resources.WelcomePageImageText_LightBulb, 31288, 41, false);
EndWriteAttribute();
WriteLiteral(" width=\"346\" height=\"658\" /></div>\r\n <div class=\"bottom\">\r\n " +
" <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLwAAADKCAYAAACv61n" +
"1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAKsZJREFUeNrs3VtsXPed2PEzc87" +
@ -621,26 +636,28 @@ using System
"4/fnoti3rKdbURKmmOp3ORmAaAAAAAIAWHga8svmUKIadoEnk+uBBYtQt2yLqeEU1+fW7Dq0VnIsDWTk" +
"643H3SgNOZ3kR8AIAAAAAoIWjGV7UBrLAnc1h1wS8omp1OKzVxqxavihcX60FHHltZ8MF29a16fxojRS" +
"uBwAAAACghf8vwABfcA5F9k0oGQAAAABJRU5ErkJggg==\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 46140), Tuple.Create("\"", 46206),
Tuple.Create(Tuple.Create("", 46167), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_Skyline, 46167), false));
WriteAttribute("title", Tuple.Create(" title=\"", 46207), Tuple.Create("\"", 46254),
Tuple.Create(Tuple.Create("", 46215), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_Skyline, 46215), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 46177, "\"", 46243, 1);
WriteAttributeValue("", 46204, Resources.WelcomePageImageText_Skyline, 46204, 39, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 46244, "\"", 46291, 1);
WriteAttributeValue("", 46252, Resources.WelcomePageImageText_Skyline, 46252, 39, false);
EndWriteAttribute();
WriteLiteral(" width=\"1212\" height=\"202\" /></div>\r\n </div>\r\n </div>\r\n\r\n <div class" +
"=\"content\">\r\n <div class=\"bodyHeadline\">");
#line 186 "WelcomePage.cshtml"
#line 187 "WelcomePage.cshtml"
Write(Resources.WelcomeHeader);
#line default
#line hidden
WriteLiteral("</div>\r\n <div class=\"bodyContent\">");
#line 187 "WelcomePage.cshtml"
#line 188 "WelcomePage.cshtml"
Write(Resources.WelcomeStarted);
#line default
#line hidden
WriteLiteral("</div>\r\n <a class=\"bodyCTA longer\" href=\"http://go.microsoft.com/fwlink/?L" +
"inkID=398596&amp;clcid=0x409\">");
#line 188 "WelcomePage.cshtml"
#line 189 "WelcomePage.cshtml"
Write(Resources.WelcomeLearnMicrosoftAspNet);
#line default
@ -676,10 +693,12 @@ using System
"Nc0+XYlr18RA5ZRt7/btjSnqsFwXE51mK68k3L/W+DqR8HRcAViFq5Xm1pGBP4wAyu751Crjs1z9ZM1w" +
"U1BLaYptsK4VktN9pRq0R9Y5/NMZL8slmC1ioSIu51ezNtkSACQ3HJckjXAX1v8nzsTxLwVBTT99OEiF" +
"xkMsNIVpu/J6yjhBpEG5mhv7vI8l+AAQB7WiwH/DuungAAAABJRU5ErkJggg==\"");
WriteAttribute("alt", Tuple.Create("\r\n alt=\"", 49086), Tuple.Create("\"", 49150),
Tuple.Create(Tuple.Create("", 49109), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LearnMore, 49109), false));
WriteAttribute("title", Tuple.Create(" title=\"", 49151), Tuple.Create("\"", 49200),
Tuple.Create(Tuple.Create("", 49159), Tuple.Create<System.Object, System.Int32>(Resources.WelcomePageImageText_LearnMore, 49159), false));
BeginWriteAttribute("alt", "\r\n alt=\"", 49123, "\"", 49187, 1);
WriteAttributeValue("", 49146, Resources.WelcomePageImageText_LearnMore, 49146, 41, false);
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 49188, "\"", 49237, 1);
WriteAttributeValue("", 49196, Resources.WelcomePageImageText_LearnMore, 49196, 41, false);
EndWriteAttribute();
WriteLiteral(" width=\"58\" height=\"29\" /></div>\r\n </a>\r\n </div>\r\n\r\n</body>\r\n</html>\r\n");
}
#pragma warning restore 1998

View File

@ -1,4 +1,5 @@
@using System
@using Microsoft.AspNet.Diagnostics
@{
Response.ContentType = "text/html";
}

View File

@ -27,5 +27,6 @@
"System.Reflection.Extensions": "4.0.1-beta-*"
}
}
}
},
"compileExclude": ["DeveloperExceptionPage/Views/*.cshtml", "RuntimeInfo/Views/*.cshtml", "WelcomePage/Views/*.cshtml"]
}

View File

@ -7,7 +7,6 @@ using System.IO;
using System.Linq;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.CodeGenerators;
using Microsoft.Dnx.Runtime;
namespace PageGenerator
{
@ -15,29 +14,16 @@ namespace PageGenerator
{
private const int NumArgs = 1;
private readonly ILibraryManager _libraryManager;
public Program(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
}
public void Main(string[] args)
{
if (args.Length != NumArgs)
{
throw new ArgumentException(string.Format("Requires {0} argument (Library Name), {1} given", NumArgs, args.Length));
}
var diagnosticsLibInfo = _libraryManager.GetLibrary(args[0]);
if (diagnosticsLibInfo == null)
{
throw new ArgumentException(string.Format(
"Unable to open library {0}. Is it spelled correctly and listed as a dependency in project.json?",
args[0]));
throw new ArgumentException(string.Format("Requires {0} argument (Project Directory), {1} given", NumArgs, args.Length));
}
var diagnosticsDir = args[0];
var viewDirectories = Directory.EnumerateDirectories(
Path.GetDirectoryName(diagnosticsLibInfo.Path), "Views", SearchOption.AllDirectories);
Path.GetDirectoryName(diagnosticsDir), "Views", SearchOption.AllDirectories);
var fileCount = 0;
foreach (var viewDir in viewDirectories)
@ -56,7 +42,8 @@ namespace PageGenerator
foreach (var fileName in cshtmlFiles)
{
Console.WriteLine(" Generating code file for view {0}...", Path.GetFileName(fileName));
GenerateCodeFile(fileName, string.Format("{0}.Views", args[0]));
var nameSpace = viewDir.Split(Path.DirectorySeparatorChar)[1];
GenerateCodeFile(fileName, $"{nameSpace}.Views");
Console.WriteLine(" Done!");
fileCount++;
}
@ -91,7 +78,7 @@ namespace PageGenerator
var code = engine.GenerateCode(
input: fileStream,
className: fileNameNoExtension,
rootNamespace: rootNamespace,
rootNamespace: Path.GetFileName(rootNamespace),
sourceFileName: fileName);
var source = code.GeneratedCode;
@ -113,7 +100,7 @@ namespace PageGenerator
var includeFileName = source.Substring(startIndex + startMatch.Length, endIndex - (startIndex + startMatch.Length));
includeFileName = SanitizeFileName(includeFileName);
Console.WriteLine(" Inlining file {0}", includeFileName);
var replacement = File.ReadAllText(Path.Combine(basePath, includeFileName)).Replace("\"", "\\\"").Replace("\r\n", "\\r\\n");
var replacement = File.ReadAllText(Path.Combine(basePath, includeFileName)).Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r");
source = source.Substring(0, startIndex) + replacement + source.Substring(endIndex + endMatch.Length);
startIndex = startIndex + replacement.Length;
}
@ -129,8 +116,15 @@ namespace PageGenerator
//"s
var invalidChars = new List<char>(Path.GetInvalidFileNameChars());
Console.WriteLine($"InvalidChars are {invalidChars}");
invalidChars.Add('+');
invalidChars.Add(' ');
//These are already in the list on windows, but for other platforms
//it seems like some of them are missing, so we add them explicitly
invalidChars.Add('"');
invalidChars.Add('\'');
invalidChars.Add('\r');
invalidChars.Add('\n');
return string.Join(string.Empty, fileName.Where(c => !invalidChars.Contains(c)).ToArray());
}

View File

@ -1,20 +1,21 @@
{
"version": "1.0.0-*",
"description": "Builds the pages for the Diagnostics projects. Runs in build.cmd.",
"repository": {
"type": "git",
"url": "git://github.com/aspnet/diagnostics"
},
"dependencies": {
"Microsoft.AspNet.Diagnostics.Elm": "1.0.0-*",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*",
"Microsoft.AspNet.Razor": "4.0.0-*"
},
"frameworks": {
"dnx451": { },
"dnx451": {
},
"dnxcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-*"
"System.Console": "4.0.0-beta-*",
"System.Runtime": "4.0.21-*"
}
}
},