Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Ydb.Sdk.Ado;
using Ydb.Sdk.Yc;

Expand All @@ -11,8 +12,9 @@
.GetConnectionString("ServerlessYDB") ??
throw new InvalidOperationException("ConnectionString.ServerlessYDB is empty.");

var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information));
var loggerFactory = LoggerFactory.Create(builder => builder.AddNLog());
var logger = loggerFactory.CreateLogger<Program>();

var stopwatch = Stopwatch.StartNew();
stopwatch.Start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Ydb.Sdk.Yc.Auth" Version="0.2.0" />
<PackageReference Include="Ydb.Sdk" Version="0.18.0" />
<PackageReference Include="CommandLineParser" Version="2.8.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0"/>
<PackageReference Include="NLog.Extensions.Logging" Version="5.5.0"/>
<PackageReference Include="Ydb.Sdk.Yc.Auth" Version="0.2.0"/>
<PackageReference Include="Ydb.Sdk" Version="0.18.0"/>

<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"ServerlessYDB": "UseTls=true;Host=<host>;Port=2135;Database=<database>"
"ServerlessYDB": "UseTls=true;Host=ydb.serverless.yandexcloud.net;Port=2135;Database=/ru-central1/b1g8skpblkos03malf3s/etnl7uv72neobbgiahii"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<targets>
<target xsi:type="Console" name="ConsoleTarget">
<layout xsi:type="JsonLayout">
<attribute name="time" layout="${longdate}" />
<attribute name="level" layout="${level:upperCase=true}" />
<attribute name="logger" layout="${logger}" />
<attribute name="message" layout="${message}" />
<attribute name='exception' layout='${exception:format=toString,StackTrace}' />
</layout>
</target>
</targets>

<rules>
<logger name="*" minlevel="Info" writeTo="ConsoleTarget" />
</rules>
</nlog>
Loading