File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Sources/TelegramBot/Builders Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ public class BotBuilder
2626 /// </summary>
2727 public ConfigurationManager Configuration { get ; }
2828
29+ /// <summary>
30+ /// A collection of logging providers for the application to compose. This is useful for adding new logging providers.
31+ /// </summary>
32+ public ILoggingBuilder Logging { get ; }
33+
2934 /// <summary>
3035 /// Initializes a new instance of the <see cref="BotBuilder"/> class with preconfigured defaults.
3136 /// </summary>
@@ -50,6 +55,7 @@ public BotBuilder(params string[] args)
5055 builder . AddConsole ( ) ;
5156 builder . AddConfiguration ( Configuration . GetSection ( "Logging" ) ) ;
5257 } ) ;
58+ Logging = new TelegramLoggerBuilder ( Services ) ;
5359 Services . AddSingleton ( Configuration ) ;
5460 Services . AddSingleton < IConfiguration > ( Configuration ) ;
5561 Services . AddSingleton < IConfigurationRoot > ( Configuration ) ;
Original file line number Diff line number Diff line change 1+ using System ;
2+ using Microsoft . Extensions . Logging ;
3+ using Microsoft . Extensions . DependencyInjection ;
4+
5+ namespace TelegramBot . Builders
6+ {
7+ internal class TelegramLoggerBuilder : ILoggingBuilder
8+ {
9+ public IServiceCollection Services { get ; }
10+
11+ internal TelegramLoggerBuilder ( IServiceCollection _services )
12+ {
13+ Services = _services ?? throw new ArgumentNullException ( nameof ( _services ) ) ;
14+ }
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments