File tree Expand file tree Collapse file tree 4 files changed +35
-8
lines changed
examples/Ydb.Sdk.AdoNet.Yandex.Cloud.Serverless.Container Expand file tree Collapse file tree 4 files changed +35
-8
lines changed Original file line number Diff line number Diff line change 11using System . Diagnostics ;
22using Microsoft . Extensions . Configuration ;
33using Microsoft . Extensions . Logging ;
4+ using NLog . Extensions . Logging ;
45using Ydb . Sdk . Ado ;
56using Ydb . Sdk . Yc ;
67
1112 . GetConnectionString ( "ServerlessYDB" ) ??
1213 throw new InvalidOperationException ( "ConnectionString.ServerlessYDB is empty." ) ;
1314
14- var loggerFactory = LoggerFactory . Create ( builder => builder . AddConsole ( ) . SetMinimumLevel ( LogLevel . Information ) ) ;
15+ var loggerFactory = LoggerFactory . Create ( builder => builder . AddNLog ( ) ) ;
1516var logger = loggerFactory . CreateLogger < Program > ( ) ;
17+
1618var stopwatch = Stopwatch . StartNew ( ) ;
1719stopwatch . Start ( ) ;
1820
Original file line number Diff line number Diff line change 99 </PropertyGroup >
1010
1111 <ItemGroup >
12- <PackageReference Include =" CommandLineParser" Version =" 2.8.0" />
13- <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 8.0.0" />
14- <PackageReference Include =" Microsoft.Extensions.Logging.Console" Version =" 8.0.0" />
15- <PackageReference Include =" Microsoft.Extensions.Logging" Version =" 8.0.0" />
16- <PackageReference Include =" Ydb.Sdk.Yc.Auth" Version =" 0.2.0" />
17- <PackageReference Include =" Ydb.Sdk" Version =" 0.18.0" />
12+ <PackageReference Include =" CommandLineParser" Version =" 2.8.0" />
13+ <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 8.0.0" />
14+ <PackageReference Include =" Microsoft.Extensions.Logging.Console" Version =" 8.0.0" />
15+ <PackageReference Include =" Microsoft.Extensions.Logging" Version =" 8.0.0" />
16+ <PackageReference Include =" NLog.Extensions.Logging" Version =" 5.5.0" />
17+ <PackageReference Include =" Ydb.Sdk.Yc.Auth" Version =" 0.2.0" />
18+ <PackageReference Include =" Ydb.Sdk" Version =" 0.18.0" />
1819
1920 <None Update =" appsettings.json" >
2021 <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
2122 </None >
23+ <None Update =" nlog.config" >
24+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
25+ </None >
2226 </ItemGroup >
2327</Project >
Original file line number Diff line number Diff line change 11{
22 "ConnectionStrings" : {
3- "ServerlessYDB" : " UseTls=true;Host=<host> ;Port=2135;Database=<database> "
3+ "ServerlessYDB" : " UseTls=true;Host=ydb.serverless.yandexcloud.net ;Port=2135;Database=/ru-central1/b1g8skpblkos03malf3s/etnl7uv72neobbgiahii "
44 }
55}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+
3+ <nlog xmlns =" http://www.nlog-project.org/schemas/NLog.xsd"
4+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
5+
6+ <targets >
7+ <target xsi : type =" Console" name =" ConsoleTarget" >
8+ <layout xsi : type =" JsonLayout" >
9+ <attribute name =" time" layout =" ${longdate}" />
10+ <attribute name =" level" layout =" ${level:upperCase=true}" />
11+ <attribute name =" logger" layout =" ${logger}" />
12+ <attribute name =" message" layout =" ${message}" />
13+ <attribute name =' exception' layout =' ${exception:format=toString,StackTrace}' />
14+ </layout >
15+ </target >
16+ </targets >
17+
18+ <rules >
19+ <logger name =" *" minlevel =" Info" writeTo =" ConsoleTarget" />
20+ </rules >
21+ </nlog >
You can’t perform that action at this time.
0 commit comments