From 45947f04924cfc1240e0f6d1a02797aa153d0188 Mon Sep 17 00:00:00 2001 From: asesidaa <1061472754@qq.com> Date: Mon, 19 Sep 2022 01:18:24 +0800 Subject: [PATCH] Use serilog for logging (support log to file) Clean up --- .../Controllers/Api/CardsController.cs | 4 +- .../Controllers/Api/DanBestDataController.cs | 1 - .../Controllers/Api/DashboardController.cs | 5 +- .../Api/FavoriteSongsController.cs | 1 - .../Controllers/Api/PlayDataController.cs | 1 - .../Controllers/Api/UserSettingsController.cs | 7 +- .../Controllers/Game/BaidController.cs | 3 +- .../Controllers/Game/CrownsDataController.cs | 4 +- .../Controllers/Game/GetAiDataController.cs | 8 +- .../Controllers/Game/GetAiScoreController.cs | 3 +- .../Controllers/Game/GetDanOdaiController.cs | 4 +- .../Controllers/Game/GetDanScoreController.cs | 4 +- .../Game/GetScoreRankController.cs | 4 +- .../Game/GetSongIntroductionController.cs | 4 +- .../Game/InitialDataCheckController.cs | 4 +- .../Controllers/Game/MyDonEntryController.cs | 5 +- .../Controllers/Game/PlayResultController.cs | 1 - .../Controllers/Game/SelfBestController.cs | 3 +- .../Controllers/Game/UserDataController.cs | 1 - TaikoLocalServer/GlobalUsings.cs | 4 +- TaikoLocalServer/Program.cs | 170 +++++++++++------- TaikoLocalServer/Services/AiDatumService.cs | 3 +- TaikoLocalServer/Services/CardService.cs | 1 - .../Services/DanScoreDatumService.cs | 4 +- .../Services/Extentions/ServiceExtensions.cs | 4 +- TaikoLocalServer/Services/GameDataService.cs | 1 - .../Services/SongBestDatumService.cs | 1 - .../Services/SongPlayDatumService.cs | 4 +- TaikoLocalServer/Services/UserDatumService.cs | 1 - TaikoLocalServer/TaikoLocalServer.csproj | 3 + TaikoLocalServer/appsettings.Development.json | 8 - TaikoLocalServer/appsettings.json | 31 +++- 32 files changed, 155 insertions(+), 147 deletions(-) delete mode 100644 TaikoLocalServer/appsettings.Development.json diff --git a/TaikoLocalServer/Controllers/Api/CardsController.cs b/TaikoLocalServer/Controllers/Api/CardsController.cs index 3438ae4..bbbea64 100644 --- a/TaikoLocalServer/Controllers/Api/CardsController.cs +++ b/TaikoLocalServer/Controllers/Api/CardsController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Api; +namespace TaikoLocalServer.Controllers.Api; [ApiController] [Route("api/[controller]")] diff --git a/TaikoLocalServer/Controllers/Api/DanBestDataController.cs b/TaikoLocalServer/Controllers/Api/DanBestDataController.cs index d286cb5..257da2f 100644 --- a/TaikoLocalServer/Controllers/Api/DanBestDataController.cs +++ b/TaikoLocalServer/Controllers/Api/DanBestDataController.cs @@ -1,7 +1,6 @@ using SharedProject.Models; using SharedProject.Models.Responses; using Swan.Mapping; -using TaikoLocalServer.Services.Interfaces; namespace TaikoLocalServer.Controllers.Api; diff --git a/TaikoLocalServer/Controllers/Api/DashboardController.cs b/TaikoLocalServer/Controllers/Api/DashboardController.cs index d080697..be07c28 100644 --- a/TaikoLocalServer/Controllers/Api/DashboardController.cs +++ b/TaikoLocalServer/Controllers/Api/DashboardController.cs @@ -1,7 +1,4 @@ -using SharedProject.Models; -using SharedProject.Models.Responses; -using Swan.Mapping; -using TaikoLocalServer.Services.Interfaces; +using SharedProject.Models.Responses; namespace TaikoLocalServer.Controllers.Api; diff --git a/TaikoLocalServer/Controllers/Api/FavoriteSongsController.cs b/TaikoLocalServer/Controllers/Api/FavoriteSongsController.cs index 5ecded6..f3c59c0 100644 --- a/TaikoLocalServer/Controllers/Api/FavoriteSongsController.cs +++ b/TaikoLocalServer/Controllers/Api/FavoriteSongsController.cs @@ -1,5 +1,4 @@ using SharedProject.Models.Requests; -using TaikoLocalServer.Services.Interfaces; namespace TaikoLocalServer.Controllers.Api; diff --git a/TaikoLocalServer/Controllers/Api/PlayDataController.cs b/TaikoLocalServer/Controllers/Api/PlayDataController.cs index 364bf16..f24bd71 100644 --- a/TaikoLocalServer/Controllers/Api/PlayDataController.cs +++ b/TaikoLocalServer/Controllers/Api/PlayDataController.cs @@ -1,5 +1,4 @@ using SharedProject.Models.Responses; -using TaikoLocalServer.Services.Interfaces; namespace TaikoLocalServer.Controllers.Api; diff --git a/TaikoLocalServer/Controllers/Api/UserSettingsController.cs b/TaikoLocalServer/Controllers/Api/UserSettingsController.cs index 40feec2..0f7b174 100644 --- a/TaikoLocalServer/Controllers/Api/UserSettingsController.cs +++ b/TaikoLocalServer/Controllers/Api/UserSettingsController.cs @@ -1,11 +1,6 @@ -using System.Buffers.Binary; -using System.Text.Json; +using System.Text.Json; using SharedProject.Models; -using SharedProject.Models.Responses; using SharedProject.Utils; -using TaikoLocalServer.Services; -using TaikoLocalServer.Services.Interfaces; -using Throw; namespace TaikoLocalServer.Controllers.Api; diff --git a/TaikoLocalServer/Controllers/Game/BaidController.cs b/TaikoLocalServer/Controllers/Game/BaidController.cs index 733b6a3..9e4a988 100644 --- a/TaikoLocalServer/Controllers/Game/BaidController.cs +++ b/TaikoLocalServer/Controllers/Game/BaidController.cs @@ -1,5 +1,4 @@ using System.Text.Json; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Controllers.Game; @@ -164,7 +163,7 @@ public class BaidController : BaseController IsDispAchievementTypeSet = true, LastPlayMode = userData.LastPlayMode, IsDispSouuchiOn = true, - AiRank = 0, + AiRank = 1, AiTotalWin = (uint)totalWin, Accesstoken = "123456", ContentInfo = GZipBytesUtil.GetGZipBytes(new byte[10]) diff --git a/TaikoLocalServer/Controllers/Game/CrownsDataController.cs b/TaikoLocalServer/Controllers/Game/CrownsDataController.cs index 41cc3c5..5d9f654 100644 --- a/TaikoLocalServer/Controllers/Game/CrownsDataController.cs +++ b/TaikoLocalServer/Controllers/Game/CrownsDataController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/crownsdata.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/GetAiDataController.cs b/TaikoLocalServer/Controllers/Game/GetAiDataController.cs index 0613254..2880229 100644 --- a/TaikoLocalServer/Controllers/Game/GetAiDataController.cs +++ b/TaikoLocalServer/Controllers/Game/GetAiDataController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/getaidata.php")] [ApiController] @@ -24,7 +22,9 @@ public class GetAiDataController : BaseController var response = new GetAiDataResponse { Result = 1, - TotalWinnings = (uint)totalWin + TotalWinnings = (uint)totalWin, + InputMedian = "1000", + InputVariance = "2000" }; return Ok(response); diff --git a/TaikoLocalServer/Controllers/Game/GetAiScoreController.cs b/TaikoLocalServer/Controllers/Game/GetAiScoreController.cs index 33447cf..1f28e97 100644 --- a/TaikoLocalServer/Controllers/Game/GetAiScoreController.cs +++ b/TaikoLocalServer/Controllers/Game/GetAiScoreController.cs @@ -1,5 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; -using Throw; +using Throw; namespace TaikoLocalServer.Controllers.Game; diff --git a/TaikoLocalServer/Controllers/Game/GetDanOdaiController.cs b/TaikoLocalServer/Controllers/Game/GetDanOdaiController.cs index beae85c..0a8a152 100644 --- a/TaikoLocalServer/Controllers/Game/GetDanOdaiController.cs +++ b/TaikoLocalServer/Controllers/Game/GetDanOdaiController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/getdanodai.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/GetDanScoreController.cs b/TaikoLocalServer/Controllers/Game/GetDanScoreController.cs index 503ea49..9d5c29c 100644 --- a/TaikoLocalServer/Controllers/Game/GetDanScoreController.cs +++ b/TaikoLocalServer/Controllers/Game/GetDanScoreController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/getdanscore.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/GetScoreRankController.cs b/TaikoLocalServer/Controllers/Game/GetScoreRankController.cs index 6d83c0d..cf41eb0 100644 --- a/TaikoLocalServer/Controllers/Game/GetScoreRankController.cs +++ b/TaikoLocalServer/Controllers/Game/GetScoreRankController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/getscorerank.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/GetSongIntroductionController.cs b/TaikoLocalServer/Controllers/Game/GetSongIntroductionController.cs index b17c4ee..d531098 100644 --- a/TaikoLocalServer/Controllers/Game/GetSongIntroductionController.cs +++ b/TaikoLocalServer/Controllers/Game/GetSongIntroductionController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/getsongintroduction.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs index c6042e7..e8f9909 100644 --- a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs +++ b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [ApiController] [Route("/v12r03/chassis/initialdatacheck.php")] diff --git a/TaikoLocalServer/Controllers/Game/MyDonEntryController.cs b/TaikoLocalServer/Controllers/Game/MyDonEntryController.cs index 2764a97..a293314 100644 --- a/TaikoLocalServer/Controllers/Game/MyDonEntryController.cs +++ b/TaikoLocalServer/Controllers/Game/MyDonEntryController.cs @@ -1,7 +1,4 @@ -using TaikoLocalServer.Services; -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Controllers.Game; +namespace TaikoLocalServer.Controllers.Game; [Route("/v12r03/chassis/mydonentry.php")] [ApiController] diff --git a/TaikoLocalServer/Controllers/Game/PlayResultController.cs b/TaikoLocalServer/Controllers/Game/PlayResultController.cs index 770fac5..6ed4642 100644 --- a/TaikoLocalServer/Controllers/Game/PlayResultController.cs +++ b/TaikoLocalServer/Controllers/Game/PlayResultController.cs @@ -1,7 +1,6 @@ using System.Buffers.Binary; using System.Globalization; using System.Text.Json; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Controllers.Game; diff --git a/TaikoLocalServer/Controllers/Game/SelfBestController.cs b/TaikoLocalServer/Controllers/Game/SelfBestController.cs index 8b1e259..d988fd4 100644 --- a/TaikoLocalServer/Controllers/Game/SelfBestController.cs +++ b/TaikoLocalServer/Controllers/Game/SelfBestController.cs @@ -1,5 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; -using Throw; +using Throw; namespace TaikoLocalServer.Controllers.Game; diff --git a/TaikoLocalServer/Controllers/Game/UserDataController.cs b/TaikoLocalServer/Controllers/Game/UserDataController.cs index 0c007a6..cbf5d15 100644 --- a/TaikoLocalServer/Controllers/Game/UserDataController.cs +++ b/TaikoLocalServer/Controllers/Game/UserDataController.cs @@ -1,6 +1,5 @@ using System.Buffers.Binary; using System.Text.Json; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Controllers.Game; diff --git a/TaikoLocalServer/GlobalUsings.cs b/TaikoLocalServer/GlobalUsings.cs index e0ed717..13e5e55 100644 --- a/TaikoLocalServer/GlobalUsings.cs +++ b/TaikoLocalServer/GlobalUsings.cs @@ -9,4 +9,6 @@ global using TaikoLocalServer.Common; global using TaikoLocalServer.Common.Utils; global using TaikoLocalServer.Context; global using TaikoLocalServer.Entities; -global using TaikoLocalServer.Models; \ No newline at end of file +global using TaikoLocalServer.Models; +global using TaikoLocalServer.Services; +global using TaikoLocalServer.Services.Interfaces; \ No newline at end of file diff --git a/TaikoLocalServer/Program.cs b/TaikoLocalServer/Program.cs index ea5cc72..1a4b16c 100644 --- a/TaikoLocalServer/Program.cs +++ b/TaikoLocalServer/Program.cs @@ -1,87 +1,121 @@ +using System.Reflection; using System.Security.Authentication; -using Microsoft.AspNetCore.HttpLogging; using Microsoft.AspNetCore.HttpOverrides; using TaikoLocalServer.Middlewares; -using TaikoLocalServer.Services; using TaikoLocalServer.Services.Extentions; -using TaikoLocalServer.Services.Interfaces; using TaikoLocalServer.Settings; using Throw; +using Serilog; -var builder = WebApplication.CreateBuilder(args); -// Manually enable tls 1.0 -builder.WebHost.UseKestrel(kestrelOptions => +Log.Logger = new LoggerConfiguration() + .WriteTo.Console() + .CreateBootstrapLogger(); + +var version = Assembly.GetEntryAssembly()?.GetCustomAttribute()? + .InformationalVersion; +Log.Information("TaikoLocalServer version {Version}", version); + +Log.Information("Server starting up..."); + +try { - kestrelOptions.ConfigureHttpsDefaults(httpsOptions => + var builder = WebApplication.CreateBuilder(args); + // Manually enable tls 1.0 + builder.WebHost.UseKestrel(kestrelOptions => { - httpsOptions.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13; + kestrelOptions.ConfigureHttpsDefaults(httpsOptions => + { + httpsOptions.SslProtocols = + SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13; + }); }); -}); -// Add services to the container. -builder.Services.AddOptions(); -builder.Services.AddSingleton(); -builder.Services.Configure(builder.Configuration.GetSection(nameof(UrlSettings))); -builder.Services.AddControllers().AddProtoBufNet(); -builder.Services.AddDbContext(option => -{ - var dbName = builder.Configuration["DbFileName"]; - if (string.IsNullOrEmpty(dbName)) + builder.Host.UseSerilog((context, configuration) => { - dbName = Constants.DEFAULT_DB_NAME; + configuration.WriteTo.Console().ReadFrom.Configuration(context.Configuration); + }); + + // Add services to the container. + builder.Services.AddOptions(); + builder.Services.AddSingleton(); + builder.Services.Configure(builder.Configuration.GetSection(nameof(UrlSettings))); + builder.Services.AddControllers().AddProtoBufNet(); + builder.Services.AddDbContext(option => + { + var dbName = builder.Configuration["DbFileName"]; + if (string.IsNullOrEmpty(dbName)) + { + dbName = Constants.DEFAULT_DB_NAME; + } + + var path = Path.Combine(PathHelper.GetRootPath(), dbName); + option.UseSqlite($"Data Source={path}"); + }); + builder.Services.AddMemoryCache(); + builder.Services.AddCors(options => + { + options.AddPolicy("AllowAllCorsPolicy", policy => + { + policy + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader(); + }); + }); + builder.Services.AddTaikoDbServices(); + + var app = builder.Build(); + + // Migrate db + using (var scope = app.Services.CreateScope()) + { + var db = scope.ServiceProvider.GetRequiredService(); + db.Database.Migrate(); } - var path = Path.Combine(PathHelper.GetRootPath(), dbName); - option.UseSqlite($"Data Source={path}"); -}); -builder.Services.AddHttpLogging(options => -{ - options.LoggingFields = HttpLoggingFields.RequestProperties | - HttpLoggingFields.ResponseStatusCode; -}); -builder.Services.AddMemoryCache(); -builder.Services.AddCors(options => -{ - options.AddPolicy("DevCorsPolicy", policy => + + app.UseSerilogRequestLogging(options => { - policy - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader(); + options.MessageTemplate = "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms, " + + "request host: {RequestHost}"; + options.EnrichDiagnosticContext = (diagnosticContext, httpContext) => + { + diagnosticContext.Set("RequestHost", httpContext.Request.Host.Value); + }; }); -}); -builder.Services.AddTaikoDbServices(); -var app = builder.Build(); + var gameDataService = app.Services.GetService(); + gameDataService.ThrowIfNull(); + await gameDataService.InitializeAsync(); -// Migrate db -using (var scope = app.Services.CreateScope()) -{ - var db = scope.ServiceProvider.GetRequiredService(); - db.Database.Migrate(); + // For reverse proxy + app.UseForwardedHeaders(new ForwardedHeadersOptions + { + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }); + + app.UseCors("AllowAllCorsPolicy"); + // For blazor hosting + app.UseBlazorFrameworkFiles(); + app.UseStaticFiles(); + app.UseRouting(); + + + app.UseHttpLogging(); + app.MapControllers(); + app.MapFallbackToFile("index.html"); + + app.UseWhen( + context => context.Request.Path.StartsWithSegments("/sys/servlet/PowerOn", StringComparison.InvariantCulture), + applicationBuilder => applicationBuilder.UseAllNetRequestMiddleware()); + + app.Run(); } - -var gameDataService = app.Services.GetService(); -gameDataService.ThrowIfNull(); -await gameDataService.InitializeAsync(); - -// For reverse proxy -app.UseForwardedHeaders(new ForwardedHeadersOptions +catch (Exception ex) { - ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto -}); - -app.UseCors("DevCorsPolicy"); -// For blazor hosting -app.UseBlazorFrameworkFiles(); -app.UseStaticFiles(); -app.UseRouting(); - - -app.UseHttpLogging(); -app.MapControllers(); -app.MapFallbackToFile("index.html"); - -app.UseWhen(context => context.Request.Path.StartsWithSegments("/sys/servlet/PowerOn", StringComparison.InvariantCulture), - applicationBuilder => applicationBuilder.UseAllNetRequestMiddleware()); - -app.Run(); \ No newline at end of file + Log.Fatal(ex, "Unhandled exception"); +} +finally +{ + Log.Information("Shut down complete"); + Log.CloseAndFlush(); +} \ No newline at end of file diff --git a/TaikoLocalServer/Services/AiDatumService.cs b/TaikoLocalServer/Services/AiDatumService.cs index 1b74374..cf8cd95 100644 --- a/TaikoLocalServer/Services/AiDatumService.cs +++ b/TaikoLocalServer/Services/AiDatumService.cs @@ -1,5 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; -using Throw; +using Throw; namespace TaikoLocalServer.Services; diff --git a/TaikoLocalServer/Services/CardService.cs b/TaikoLocalServer/Services/CardService.cs index cd6006b..82df2b2 100644 --- a/TaikoLocalServer/Services/CardService.cs +++ b/TaikoLocalServer/Services/CardService.cs @@ -1,6 +1,5 @@ using SharedProject.Models; using Swan.Mapping; -using TaikoLocalServer.Services.Interfaces; namespace TaikoLocalServer.Services; diff --git a/TaikoLocalServer/Services/DanScoreDatumService.cs b/TaikoLocalServer/Services/DanScoreDatumService.cs index 3e91419..b46ed4e 100644 --- a/TaikoLocalServer/Services/DanScoreDatumService.cs +++ b/TaikoLocalServer/Services/DanScoreDatumService.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Services; +namespace TaikoLocalServer.Services; public class DanScoreDatumService : IDanScoreDatumService { diff --git a/TaikoLocalServer/Services/Extentions/ServiceExtensions.cs b/TaikoLocalServer/Services/Extentions/ServiceExtensions.cs index 9886ad2..bd9642b 100644 --- a/TaikoLocalServer/Services/Extentions/ServiceExtensions.cs +++ b/TaikoLocalServer/Services/Extentions/ServiceExtensions.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Services.Extentions; +namespace TaikoLocalServer.Services.Extentions; public static class ServiceExtensions { diff --git a/TaikoLocalServer/Services/GameDataService.cs b/TaikoLocalServer/Services/GameDataService.cs index f7fd748..a22546e 100644 --- a/TaikoLocalServer/Services/GameDataService.cs +++ b/TaikoLocalServer/Services/GameDataService.cs @@ -2,7 +2,6 @@ using System.Text.Json; using SharedProject.Models; using Swan.Mapping; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Services; diff --git a/TaikoLocalServer/Services/SongBestDatumService.cs b/TaikoLocalServer/Services/SongBestDatumService.cs index 0771092..e46bad3 100644 --- a/TaikoLocalServer/Services/SongBestDatumService.cs +++ b/TaikoLocalServer/Services/SongBestDatumService.cs @@ -1,6 +1,5 @@ using SharedProject.Models; using Swan.Mapping; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Services; diff --git a/TaikoLocalServer/Services/SongPlayDatumService.cs b/TaikoLocalServer/Services/SongPlayDatumService.cs index c07e15f..50d9bb2 100644 --- a/TaikoLocalServer/Services/SongPlayDatumService.cs +++ b/TaikoLocalServer/Services/SongPlayDatumService.cs @@ -1,6 +1,4 @@ -using TaikoLocalServer.Services.Interfaces; - -namespace TaikoLocalServer.Services; +namespace TaikoLocalServer.Services; class SongPlayDatumService : ISongPlayDatumService { diff --git a/TaikoLocalServer/Services/UserDatumService.cs b/TaikoLocalServer/Services/UserDatumService.cs index f71b646..83bd54d 100644 --- a/TaikoLocalServer/Services/UserDatumService.cs +++ b/TaikoLocalServer/Services/UserDatumService.cs @@ -1,5 +1,4 @@ using System.Text.Json; -using TaikoLocalServer.Services.Interfaces; using Throw; namespace TaikoLocalServer.Services; diff --git a/TaikoLocalServer/TaikoLocalServer.csproj b/TaikoLocalServer/TaikoLocalServer.csproj index 76728c3..a4f65a9 100644 --- a/TaikoLocalServer/TaikoLocalServer.csproj +++ b/TaikoLocalServer/TaikoLocalServer.csproj @@ -4,6 +4,7 @@ net6.0 enable enable + 0.3.0-alpha @@ -20,6 +21,8 @@ + + diff --git a/TaikoLocalServer/appsettings.Development.json b/TaikoLocalServer/appsettings.Development.json deleted file mode 100644 index 3e1a225..0000000 --- a/TaikoLocalServer/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Information" - } - } -} diff --git a/TaikoLocalServer/appsettings.json b/TaikoLocalServer/appsettings.json index d54a8f7..5553448 100644 --- a/TaikoLocalServer/appsettings.json +++ b/TaikoLocalServer/appsettings.json @@ -3,15 +3,36 @@ "MuchaUrl": "https://v402-front.mucha-prd.nbgi-amnet.jp:10122", "GameUrl": "vsapi.taiko-p.jp" }, + "DbFileName" : "taiko.db3", - "Logging": { - "LogLevel": { + + "Serilog": { + "MinimumLevel": { "Default": "Information", - "Microsoft.AspNetCore": "Warning", - "Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information" - } + "Override": { + "Microsoft": "Warning", + "Microsoft.AspNetCore": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "Filter": [ + { + "Name": "ByExcluding", + "Args": { + "expression": "@mt = 'An unhandled exception has occurred while executing the request.'" + } + } + ], + "WriteTo": [ + { + "Name": "File", + "Args": { "path": "./Logs/log-.txt", "rollingInterval": "Day" } + } + ] }, + "AllowedHosts": "*", + "Kestrel": { "Endpoints": { "Server": {