Skip to content

Commit 2e6e74c

Browse files
committed
Updated Obsolete attribute in ConsoleLog.cs to include DiagnosticId and UrlFormat for better guidance on deprecation.
Updated logging statements in `ServiceCollectionExtensions.cs` and `Startup.cs` to use `Log.ForContext<Startup>()` for more context-specific logging. Adjusted logging configuration in `appsettings.Development.json` and `appsettings.Production.json` to include settings for `VirtoCommerce.Platform.Web.Startup` and modified logging levels for `VirtoCommerce.Platform.Modules`.
1 parent ace5530 commit 2e6e74c

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

src/VirtoCommerce.Platform.Core/Logger/ConsoleLog.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace VirtoCommerce.Platform.Core.Logger
44
{
5-
[Obsolete("Use Serilog's static Log.Logger or inject ILogger instead")]
5+
[Obsolete("Use Serilog's static Log.Logger or inject ILogger instead", DiagnosticId = "VC0010", UrlFormat = "https://docs.virtocommerce.org/platform/user-guide/versions/virto3-products-versions/")]
66
public static class ConsoleLog
77
{
88
public static void BeginOperation(string message)

src/VirtoCommerce.Platform.Web/Extensions/ServiceCollectionExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using VirtoCommerce.Platform.Core.Common;
99
using VirtoCommerce.Platform.Core.Modularity;
1010
using VirtoCommerce.Platform.Modules.External;
11+
using VirtoCommerce.Platform.Web;
1112

1213
namespace VirtoCommerce.Platform.Modules
1314
{
@@ -38,7 +39,7 @@ public static IServiceCollection AddModules(this IServiceCollection services, IM
3839
manager.Run();
3940

4041
// Ensure all modules are loaded
41-
Log.Logger.Information("Registering API controllers");
42+
Log.ForContext<Startup>().Information("Registering API controllers");
4243

4344
var notStartedModules = moduleCatalog.Modules.Where(x => x.State == ModuleState.NotStarted);
4445
var modules = moduleCatalog.CompleteListWithDependencies(notStartedModules)

src/VirtoCommerce.Platform.Web/Startup.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void ConfigureServices(IServiceCollection services)
116116
// to avoid exception about frozen logger because BuildServiceProvider is called multiple times
117117
}, preserveStaticLogger: true);
118118

119-
Log.Logger.Information("Virto Commerce is loading");
119+
Log.ForContext<Startup>().Information("Virto Commerce is loading");
120120

121121
var databaseProvider = Configuration.GetValue("DatabaseProvider", "SqlServer");
122122

@@ -317,7 +317,7 @@ public void ConfigureServices(IServiceCollection services)
317317
break;
318318
}
319319

320-
Log.Logger.Information("Getting server certificate");
320+
Log.ForContext<Startup>().Information("Getting server certificate");
321321
ServerCertificate = GetServerCertificate(certificateLoader);
322322

323323
//Create backup of token handler before default claim maps are cleared
@@ -686,7 +686,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<
686686
app.UseAutoAccountsLockoutJob(options.Value);
687687

688688
// Complete modules startup and apply their migrations
689-
Log.Logger.Information("Post initializing modules");
689+
Log.ForContext<Startup>().Information("Post initializing modules");
690690

691691
app.UseModules();
692692
});

src/VirtoCommerce.Platform.Web/appsettings.Development.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"Microsoft": "Information",
1212
"Microsoft.AspNetCore.SignalR": "Verbose",
1313
"Microsoft.AspNetCore.Http.Connections": "Verbose",
14-
"VirtoCommerce.Platform.Modules": "Information"
14+
"VirtoCommerce.Platform.Modules": "Information",
15+
"VirtoCommerce.Platform.Web.Startup": "Information"
1516
}
1617
},
1718
"WriteTo": [

src/VirtoCommerce.Platform.Web/appsettings.Production.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"System": "Error",
1010
"Microsoft": "Warning",
1111
"Microsoft.Hosting.Lifetime": "Information",
12+
"VirtoCommerce.Platform.Modules": "Debug",
1213
"VirtoCommerce.Platform.Web.Startup": "Information"
1314
}
1415
},

0 commit comments

Comments
 (0)