Skip to content

Commit fa31e40

Browse files
committed
Adjust log info.
1 parent 0491ff9 commit fa31e40

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/MvcDemo/HostExtensions.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ public static class HostExtensions
1818
{
1919
public static WebApplicationBuilder ConfigureServices(this WebApplicationBuilder builder)
2020
{
21+
Debug.WriteLine("Create a temporary logger for me.");
2122
// Build a temporary logger for me.
2223
using var loggerFactory = LoggerFactory.Create(logging =>
2324
{
2425
logging.AddConsole();
2526
#if DEBUG
2627
logging.SetMinimumLevel(LogLevel.Trace);
2728
#else
28-
logging.SetMinimumLevel(LogLevel.Debug);
29+
logging.SetMinimumLevel(LogLevel.LogInformation);
2930
#endif
3031
});
3132
var logger = loggerFactory.CreateLogger<WebApplicationBuilder>();
32-
logger.LogTrace($"{MethodBase.GetCurrentMethod().Name}...");
33-
logger.LogDebug("Environment=" + builder.Environment.EnvironmentName);
33+
logger.LogDebug($"{MethodBase.GetCurrentMethod().Name}...");
34+
logger.LogInformation("Environment=" + builder.Environment.EnvironmentName);
3435

3536
var Configuration = builder.Configuration;
3637

@@ -65,9 +66,9 @@ public static WebApplicationBuilder ConfigureServices(this WebApplicationBuilder
6566
o.AccessDeniedPath = "/Identity/Account/AccessDenied";
6667
});
6768

68-
logger?.LogDebug("WeixinOpen:AppId=" + Configuration["WeixinOpen:AppId"]);
69-
logger?.LogDebug("WeixinAuth:AppId=" + Configuration["WeixinAuth:AppId"]);
70-
logger?.LogDebug("QQConnect:AppId=" + Configuration["QQConnect:AppId"]);
69+
logger?.LogInformation("WeixinOpen:AppId=" + Configuration["WeixinOpen:AppId"]);
70+
logger?.LogInformation("WeixinAuth:AppId=" + Configuration["WeixinAuth:AppId"]);
71+
logger?.LogInformation("QQConnect:AppId=" + Configuration["QQConnect:AppId"]);
7172

7273
builder.Services.AddAuthentication()
7374
.AddWeixinOpen(o =>
@@ -96,7 +97,7 @@ public static WebApplicationBuilder ConfigureServices(this WebApplicationBuilder
9697
QQConnectScopes.do_like);
9798
});
9899

99-
logger?.LogDebug("TencensSms:SdkAppId=" + Configuration["TencentSms:SdkAppId"]);
100+
logger?.LogInformation("TencensSms:SdkAppId=" + Configuration["TencentSms:SdkAppId"]);
100101

101102
builder.Services.AddTencentSms(o =>
102103
{
@@ -106,7 +107,7 @@ public static WebApplicationBuilder ConfigureServices(this WebApplicationBuilder
106107

107108
builder.Services.AddViewDivert();
108109

109-
logger?.LogDebug("Weixin:AppId=" + Configuration["Weixin:AppId"]);
110+
logger?.LogInformation("Weixin:AppId=" + Configuration["Weixin:AppId"]);
110111

111112
builder.Services.AddWeixin(o =>
112113
{
@@ -139,7 +140,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)
139140
{
140141
var logger = app.Logger;
141142
logger.LogTrace($"{MethodBase.GetCurrentMethod().Name}...");
142-
logger.LogDebug($"Environment={app.Environment.EnvironmentName}");
143+
logger.LogInformation($"Environment={app.Environment.EnvironmentName}");
143144

144145
var env = app.Environment;
145146
if (env.IsDevelopment())

0 commit comments

Comments
 (0)