This commit is contained in:
Aleksandr Popov
2023-06-24 17:27:22 +02:00
parent 0fc517bc2b
commit 4df16b26db
5 changed files with 40 additions and 12 deletions
-6
View File
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TURN.Services.Chess", "TURN.Services.Chess\TURN.Services.Chess.csproj", "{8D4377EA-91FB-464B-8B16-3BEE15F56616}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TURN.Services.Chess", "TURN.Services.Chess\TURN.Services.Chess.csproj", "{8D4377EA-91FB-464B-8B16-3BEE15F56616}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TURN.Libraries.Core", "TURN.Libraries.Core\TURN.Libraries.Core.csproj", "{54ACF6B1-2512-47C4-877A-5B78E9001B8C}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{9E564C7C-C521-47AC-9CD1-F475B2E4174C}" Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{9E564C7C-C521-47AC-9CD1-F475B2E4174C}"
EndProject EndProject
Global Global
@@ -19,10 +17,6 @@ Global
{8D4377EA-91FB-464B-8B16-3BEE15F56616}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D4377EA-91FB-464B-8B16-3BEE15F56616}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D4377EA-91FB-464B-8B16-3BEE15F56616}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D4377EA-91FB-464B-8B16-3BEE15F56616}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D4377EA-91FB-464B-8B16-3BEE15F56616}.Release|Any CPU.Build.0 = Release|Any CPU {8D4377EA-91FB-464B-8B16-3BEE15F56616}.Release|Any CPU.Build.0 = Release|Any CPU
{54ACF6B1-2512-47C4-877A-5B78E9001B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54ACF6B1-2512-47C4-877A-5B78E9001B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54ACF6B1-2512-47C4-877A-5B78E9001B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54ACF6B1-2512-47C4-877A-5B78E9001B8C}.Release|Any CPU.Build.0 = Release|Any CPU
{9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E564C7C-C521-47AC-9CD1-F475B2E4174C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TURN.Libraries.Core</RootNamespace> <RootNamespace>TURN.Libraries.Core</RootNamespace>
<AssemblyName>TURN.Libraries.Core</AssemblyName> <AssemblyName>TURN.Libraries.Core</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
+37
View File
@@ -0,0 +1,37 @@
using System.Text;
using NLog;
using NLog.Targets;
namespace TURN.Services.Chess
{
public static class LoggerFactory
{
public static Logger GetLogger()
{
return LogManager.Setup().LoadConfiguration(c =>
{
ColoredConsoleTarget consoleTarget = new()
{
Layout = "${date}|${level:uppercase=true}|${message:withexception=true}"
};
FileTarget fileTarget = new()
{
FileName = Environment.GetEnvironmentVariable("LOG_FILE_PATH"),
Layout = "${date}|${level:uppercase=true}|${message:withexception=true}",
Encoding = Encoding.UTF8,
LineEnding = LineEndingMode.CRLF,
KeepFileOpen = true,
ConcurrentWrites = true,
ArchiveAboveSize = long.Parse(Environment.GetEnvironmentVariable("LOG_FILE_SIZE")),
MaxArchiveFiles = 10,
MaxArchiveDays = 365
};
_ = c.ForLogger("consoleAndFile")
.FilterMinLevel(NLog.LogLevel.Debug)
.WriteTo(consoleTarget)
.WriteTo(fileTarget);
}).GetLogger("consoleAndFile");
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using TURN.Services.Chess; using TURN.Services.Chess;
using LoggerFactory = TURN.Libraries.Core.LoggerFactory; using LoggerFactory = TURN.Services.Chess.LoggerFactory;
NLog.Logger logger = LoggerFactory.GetLogger(); NLog.Logger logger = LoggerFactory.GetLogger();
logger.Info("Chess app starting."); logger.Info("Chess app starting.");
@@ -21,8 +21,4 @@
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TURN.Libraries.Core\TURN.Libraries.Core.csproj" />
</ItemGroup>
</Project> </Project>