Reacting to verbose rename

This commit is contained in:
John Luo 2015-12-06 17:42:49 -08:00
parent 206b7b9113
commit 0fd5970b8a
11 changed files with 61 additions and 48 deletions

View File

@ -1,4 +1,12 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:41542/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
@ -9,7 +17,10 @@
},
"web": {
"commandName": "web",
"commandLineArgs": " "
"commandLineArgs": " ",
"environmentVariables": {
"Hosting:Environment": "Development"
}
}
}
}

View File

@ -23,7 +23,7 @@ namespace ElmPageSample
{
using (_logger.BeginScope("Scope1"))
{
_logger.LogVerbose("Getting message");
_logger.LogDebug("Getting message");
httpContext.Response.ContentType = "text/html; charset=utf-8";
await httpContext.Response.WriteAsync(

View File

@ -15,7 +15,7 @@ namespace ElmPageSample
services.ConfigureElm(elmOptions =>
{
elmOptions.Filter = (loggerName, loglevel) => loglevel == LogLevel.Verbose;
elmOptions.Filter = (loggerName, loglevel) => loglevel == LogLevel.Debug;
});
}

View File

@ -18,7 +18,7 @@ namespace MiddlewareAnaysisSample
public void Configure(IApplicationBuilder app, ILoggerFactory factory, DiagnosticListener diagnosticListener)
{
// Displays all log levels
factory.AddConsole(LogLevel.Verbose);
factory.AddConsole(LogLevel.Debug);
// Listen for middleware events and log them to the console.
var listener = new TestDiagnosticListener();

View File

@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Diagnostics.Elm
{
var options = new ViewOptions()
{
MinLevel = LogLevel.Verbose,
MinLevel = LogLevel.Debug,
NamePrefix = string.Empty
};
var isRedirect = false;

View File

@ -109,7 +109,7 @@ using Microsoft.Extensions.Logging
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Severity = LogLevel.Debug,
Message = "Beginning " + node.State,
}, level));
@ -150,7 +150,7 @@ using Microsoft.Extensions.Logging
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Severity = LogLevel.Debug,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level));
});
@ -183,7 +183,7 @@ using Microsoft.Extensions.Logging
<script src=""//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.1.min.js""></script>
<style>
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}
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.debug {\r\n color: black;\r\n}\r\n\r\n.warning {\r\n color: orange;\r\n}
</style>
</head>
<body>
@ -208,9 +208,9 @@ using Microsoft.Extensions.Logging
#line hidden
WriteLiteral(" <option");
BeginWriteAttribute("value", " value=\"", 4908, "\"", 4928, 1);
BeginWriteAttribute("value", " value=\"", 4904, "\"", 4924, 1);
#line 138 "LogPage.cshtml"
WriteAttributeValue("", 4916, severityInt, 4916, 12, false);
WriteAttributeValue("", 4912, severityInt, 4912, 12, false);
#line default
#line hidden
@ -231,9 +231,9 @@ WriteAttributeValue("", 4916, severityInt, 4916, 12, false);
#line hidden
WriteLiteral(" <option");
BeginWriteAttribute("value", " value=\"", 5057, "\"", 5077, 1);
BeginWriteAttribute("value", " value=\"", 5053, "\"", 5073, 1);
#line 142 "LogPage.cshtml"
WriteAttributeValue("", 5065, severityInt, 5065, 12, false);
WriteAttributeValue("", 5061, severityInt, 5061, 12, false);
#line default
#line hidden
@ -253,9 +253,9 @@ WriteAttributeValue("", 5065, severityInt, 5065, 12, false);
#line hidden
WriteLiteral(" </select>\r\n <input type=\"text\" name=\"name\"");
BeginWriteAttribute("value", " value=\"", 5190, "\"", 5223, 1);
BeginWriteAttribute("value", " value=\"", 5186, "\"", 5219, 1);
#line 146 "LogPage.cshtml"
WriteAttributeValue("", 5198, Model.Options.NamePrefix, 5198, 25, false);
WriteAttributeValue("", 5194, Model.Options.NamePrefix, 5194, 25, false);
#line default
#line hidden
@ -315,16 +315,16 @@ WriteAttributeValue("", 5198, Model.Options.NamePrefix, 5198, 25, false);
#line hidden
WriteLiteral(" \t<td><a");
BeginWriteAttribute("href", " href=\"", 6287, "\"", 6307, 1);
BeginWriteAttribute("href", " href=\"", 6283, "\"", 6303, 1);
#line 178 "LogPage.cshtml"
WriteAttributeValue("", 6294, activityPath, 6294, 13, false);
WriteAttributeValue("", 6290, activityPath, 6290, 13, false);
#line default
#line hidden
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 6308, "\"", 6339, 1);
BeginWriteAttribute("title", " title=\"", 6304, "\"", 6335, 1);
#line 178 "LogPage.cshtml"
WriteAttributeValue("", 6316, activity.HttpInfo.Path, 6316, 23, false);
WriteAttributeValue("", 6312, activity.HttpInfo.Path, 6312, 23, false);
#line default
#line hidden
@ -363,16 +363,16 @@ WriteAttributeValue("", 6316, activity.HttpInfo.Path, 6316, 23, false);
#line hidden
WriteLiteral(" <td colspan=\"4\"><a");
BeginWriteAttribute("href", " href=\"", 6729, "\"", 6749, 1);
BeginWriteAttribute("href", " href=\"", 6725, "\"", 6745, 1);
#line 185 "LogPage.cshtml"
WriteAttributeValue("", 6736, activityPath, 6736, 13, false);
WriteAttributeValue("", 6732, activityPath, 6732, 13, false);
#line default
#line hidden
EndWriteAttribute();
BeginWriteAttribute("title", " title=\"", 6750, "\"", 6778, 1);
BeginWriteAttribute("title", " title=\"", 6746, "\"", 6774, 1);
#line 185 "LogPage.cshtml"
WriteAttributeValue("", 6758, activity.Root.State, 6758, 20, false);
WriteAttributeValue("", 6754, activity.Root.State, 6754, 20, false);
#line default
#line hidden
@ -393,9 +393,9 @@ WriteAttributeValue("", 6758, activity.Root.State, 6758, 20, false);
#line hidden
WriteLiteral(" <td colspan=\"4\"><a");
BeginWriteAttribute("href", " href=\"", 6941, "\"", 6961, 1);
BeginWriteAttribute("href", " href=\"", 6937, "\"", 6957, 1);
#line 189 "LogPage.cshtml"
WriteAttributeValue("", 6948, activityPath, 6948, 13, false);
WriteAttributeValue("", 6944, activityPath, 6944, 13, false);
#line default
#line hidden
@ -434,7 +434,7 @@ WriteAttributeValue("", 6948, activityPath, 6948, 13, false);
counts["Error"] = 0;
counts["Warning"] = 0;
counts["Information"] = 0;
counts["Verbose"] = 0;
counts["Debug"] = 0;
#line default
@ -503,7 +503,7 @@ WriteAttributeValue("", 6948, activityPath, 6948, 13, false);
#line 228 "LogPage.cshtml"
foreach (var kvp in counts)
{
if (string.Equals("Verbose", kvp.Key)) {
if (string.Equals("Debug", kvp.Key)) {
#line default
#line hidden

View File

@ -64,7 +64,7 @@
{
Name = node.Name,
Time = node.StartTime,
Severity = LogLevel.Verbose,
Severity = LogLevel.Debug,
Message = "Beginning " + node.State,
}, level));
@ -105,7 +105,7 @@
{
Name = node.Name,
Time = node.EndTime,
Severity = LogLevel.Verbose,
Severity = LogLevel.Debug,
Message = string.Format("Completed {0} in {1}ms", node.State, node.EndTime - node.StartTime)
}, level));
});
@ -207,7 +207,7 @@
counts["Error"] = 0;
counts["Warning"] = 0;
counts["Information"] = 0;
counts["Verbose"] = 0;
counts["Debug"] = 0;
}
<tbody class="logBody">
@if (!activity.RepresentsScope)
@ -227,7 +227,7 @@
<td>@activity.Time.ToString("MM-dd-yyyy HH:mm:ss")</td>
@foreach (var kvp in counts)
{
if (string.Equals("Verbose", kvp.Key)) {
if (string.Equals("Debug", kvp.Key)) {
<td>@kvp.Value @kvp.Key<span class="collapse">v</span></td>
}
else

View File

@ -30,7 +30,7 @@ tr:nth-child(2n) {
color: blue;
}
.verbose {
.debug {
color: black;
}

View File

@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
var creator = dbContext.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator;
if (creator == null)
{
_logger.LogVerbose(Strings.DatabaseErrorPage_NotRelationalDatabase);
_logger.LogDebug(Strings.DatabaseErrorPage_NotRelationalDatabase);
}
else
{
@ -140,11 +140,11 @@ namespace Microsoft.AspNet.Diagnostics.Entity
private static bool ShouldDisplayErrorPage(DataStoreErrorLogger.DataStoreErrorLog lastError, Exception exception, ILogger logger)
{
logger.LogVerbose(Strings.FormatDatabaseErrorPage_AttemptingToMatchException(exception.GetType()));
logger.LogDebug(Strings.FormatDatabaseErrorPage_AttemptingToMatchException(exception.GetType()));
if (!lastError.IsErrorLogged)
{
logger.LogVerbose(Strings.DatabaseErrorPage_NoRecordedException);
logger.LogDebug(Strings.DatabaseErrorPage_NoRecordedException);
return false;
}
@ -156,11 +156,11 @@ namespace Microsoft.AspNet.Diagnostics.Entity
if (!match)
{
logger.LogVerbose(Strings.DatabaseErrorPage_NoMatch);
logger.LogDebug(Strings.DatabaseErrorPage_NoMatch);
return false;
}
logger.LogVerbose(Strings.DatabaseErrorPage_Matched);
logger.LogDebug(Strings.DatabaseErrorPage_Matched);
return true;
}
}

View File

@ -58,14 +58,14 @@ namespace Microsoft.AspNet.Diagnostics.Entity
if (context.Request.Path.Equals(_options.Path))
{
_logger.LogVerbose(Strings.FormatMigrationsEndPointMiddleware_RequestPathMatched(context.Request.Path));
_logger.LogDebug(Strings.FormatMigrationsEndPointMiddleware_RequestPathMatched(context.Request.Path));
var db = await GetDbContext(context, _logger);
if (db != null)
{
try
{
_logger.LogVerbose(Strings.FormatMigrationsEndPointMiddleware_ApplyingMigrations(db.GetType().FullName));
_logger.LogDebug(Strings.FormatMigrationsEndPointMiddleware_ApplyingMigrations(db.GetType().FullName));
db.Database.Migrate();
@ -73,7 +73,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
context.Response.Headers.Add("Pragma", new[] { "no-cache" });
context.Response.Headers.Add("Cache-Control", new[] { "no-cache" });
_logger.LogVerbose(Strings.FormatMigrationsEndPointMiddleware_Applied(db.GetType().FullName));
_logger.LogDebug(Strings.FormatMigrationsEndPointMiddleware_Applied(db.GetType().FullName));
}
catch (Exception ex)
{

View File

@ -67,14 +67,15 @@ namespace Microsoft.AspNet.Diagnostics.Tests
var store = t.Item2;
// Act
logger.Log(LogLevel.Verbose, 0, _state, null, null);
logger.Log(LogLevel.Trace, 0, _state, null, null);
logger.Log(LogLevel.Debug, 0, _state, null, null);
logger.Log(LogLevel.Information, 0, _state, null, null);
logger.Log(LogLevel.Warning, 0, _state, null, null);
logger.Log(LogLevel.Error, 0, _state, null, null);
logger.Log(LogLevel.Critical, 0, _state, null, null);
// Assert
Assert.Equal(5, (store.GetActivities().SelectMany(a => NodeLogs(a.Root, new List<LogInfo>()))).ToList().Count);
Assert.Equal(6, (store.GetActivities().SelectMany(a => NodeLogs(a.Root, new List<LogInfo>()))).ToList().Count);
}
[Theory]
@ -83,7 +84,7 @@ namespace Microsoft.AspNet.Diagnostics.Tests
[InlineData(LogLevel.Warning, "bad", 0)]
[InlineData(LogLevel.Critical, "", 1)]
[InlineData(LogLevel.Critical, "test", 1)]
[InlineData(LogLevel.Verbose, "t", 5)]
[InlineData(LogLevel.Trace, "t", 6)]
public void Filter_LogsWhenAppropriate(LogLevel minLevel, string prefix, int count)
{
// Arrange
@ -92,7 +93,8 @@ namespace Microsoft.AspNet.Diagnostics.Tests
var store = t.Item2;
// Act
logger.Log(LogLevel.Verbose, 0, _state, null, null);
logger.Log(LogLevel.Trace, 0, _state, null, null);
logger.Log(LogLevel.Debug, 0, _state, null, null);
logger.Log(LogLevel.Information, 0, _state, null, null);
logger.Log(LogLevel.Warning, 0, _state, null, null);
logger.Log(LogLevel.Error, 0, _state, null, null);
@ -248,7 +250,7 @@ namespace Microsoft.AspNet.Diagnostics.Tests
{
using (logger.BeginScope("test7"))
{
logger.LogVerbose("hi");
logger.LogTrace("hi");
}
}
@ -267,7 +269,7 @@ namespace Microsoft.AspNet.Diagnostics.Tests
// Act
using (logger.BeginScope("test8"))
{
logger.LogVerbose("hi");
logger.LogDebug("hi");
using (logger.BeginScope("test9"))
{
}
@ -331,20 +333,20 @@ namespace Microsoft.AspNet.Diagnostics.Tests
{
for (var i = 0; i < 5; i++)
{
_logger.LogVerbose(string.Format("xxx {0}", i));
_logger.LogDebug(string.Format("xxx {0}", i));
Thread.Sleep(5);
}
using (_logger.BeginScope("test13"))
{
for (var i = 0; i < 3; i++)
{
_logger.LogVerbose(string.Format("yyy {0}", i));
_logger.LogDebug(string.Format("yyy {0}", i));
Thread.Sleep(200);
}
}
for (var i = 0; i < 7; i++)
{
_logger.LogVerbose(string.Format("zzz {0}", i));
_logger.LogDebug(string.Format("zzz {0}", i));
Thread.Sleep(40);
}
}