@using System
@using System.Globalization
@using System.Linq
@using Microsoft.AspNet.Diagnostics.Elm
@using Microsoft.AspNet.Diagnostics.Views
@using Microsoft.AspNet.Diagnostics.Elm.Views
@using Microsoft.Extensions.Logging
@functions
{
public DetailsPage(DetailsPageModel model)
{
Model = model;
}
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)))
{
| @string.Format("{0:MM/dd/yy}", log.Time) |
@string.Format("{0:H:mm:ss}", log.Time) |
@log.Severity |
@log.Name |
@log.Message |
@log.Exception |
}
}
@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])
}
}
}
ASP.NET Logs
ASP.NET Logs
@{
var context = Model.Activity?.HttpInfo;
}
@if (context != null)
{
| Path |
@context.Path |
| Host |
@context.Host |
| Content Type |
@context.ContentType |
| Method |
@context.Method |
| Protocol |
@context.Protocol |
| Headers |
| Status Code |
@context.StatusCode |
| User |
@context.User.Identity.Name |
| Claims |
@if (context.User.Claims.Any())
{
| Issuer |
Value |
@foreach (var claim in context.User.Claims)
{
| @claim.Issuer |
@claim.Value |
}
}
|
| Scheme |
@context.Scheme |
| Query |
@context.Query.Value |
| Cookies |
@if (context.Cookies.Any())
{
| Variable |
Value |
@foreach (var cookie in context.Cookies)
{
| @cookie.Key |
@string.Join(";", cookie.Value) |
}
}
|
}
Logs
| Date |
Time |
Severity |
Name |
State |
Error |
@Traverse(Model.Activity.Root)