File tree Expand file tree Collapse file tree 4 files changed +6
-21
lines changed
src/X.Serilog.Sinks.Telegram Expand file tree Collapse file tree 4 files changed +6
-21
lines changed Original file line number Diff line number Diff line change 1818while ( logsCounter <= logsThreshold )
1919{
2020 var level = Random . Shared . NextInt64 ( 0 , 6 ) ;
21- Log . Logger . Write ( ( LogEventLevel ) level , "Message" ) ;
21+ Log . Logger . Write ( ( LogEventLevel ) level , "Message {counter}" , logsCounter ) ;
2222 await Task . Delay ( 500 ) ;
2323
2424 logsCounter ++ ;
Original file line number Diff line number Diff line change 44using Serilog ;
55using Serilog . Events ;
66using System . Collections . Immutable ;
7- using X . Serilog . Sinks . Telegram ;
87using X . Serilog . Sinks . Telegram . Batch . Rules ;
98using X . Serilog . Sinks . Telegram . Configuration ;
109using X . Serilog . Sinks . Telegram . Extensions ;
11- using X . Serilog . Sinks . Telegram . Filters ;
1210
1311var builder = WebApplication . CreateBuilder ( args ) ;
1412
2927 config . LogFiltersConfiguration = new LogsFiltersConfiguration
3028 {
3129 ApplyLogFilters = false ,
32- FiltersOperator = LogFiltersOperator . And ,
33- Filters = new IFilter [ ]
34- {
35- new LogMessageContainsFilter ( "absolutely required term" ) ,
36- new LogMessageNotContainsFilter ( "term to skip" )
37- } . ToImmutableList ( )
3830 } ;
3931 config . FormatterConfiguration = new FormatterConfiguration
4032 {
Original file line number Diff line number Diff line change 1- using System . Collections . Immutable ;
2- using X . Serilog . Sinks . Telegram . Filters ;
1+ using X . Serilog . Sinks . Telegram . Filters . Fluent ;
32
43namespace X . Serilog . Sinks . Telegram . Configuration ;
54
@@ -14,12 +13,7 @@ public class LogsFiltersConfiguration
1413 public bool ApplyLogFilters { get ; init ; }
1514
1615 /// <summary>
17- /// Gets or initializes the operator used for combining filters. The default is 'And'.
16+ /// Logs filtering query builder
1817 /// </summary>
19- public LogFiltersOperator FiltersOperator { get ; init ; } = LogFiltersOperator . And ;
20-
21- /// <summary>
22- /// Gets or initializes the list of filters to be applied.
23- /// </summary>
24- public IImmutableList < IFilter > ? Filters { get ; init ; }
18+ public ILogQueryBuilder ? QueryBuilder { get ; set ; }
2519}
Original file line number Diff line number Diff line change 11using System . Collections . Immutable ;
22using X . Serilog . Sinks . Telegram . Batch . Rules ;
33using X . Serilog . Sinks . Telegram . Configuration ;
4- using X . Serilog . Sinks . Telegram . Filters ;
4+ using X . Serilog . Sinks . Telegram . Filters . Fluent ;
55
66namespace X . Serilog . Sinks . Telegram . Extensions ;
77
@@ -48,8 +48,7 @@ private static LoggerConfiguration TelegramCoreInternal(
4848 config . FormatterConfiguration = FormatterConfiguration . Default ;
4949 config . LogFiltersConfiguration = new LogsFiltersConfiguration
5050 {
51- ApplyLogFilters = false ,
52- Filters = new ImmutableArray < IFilter > ( )
51+ ApplyLogFilters = false
5352 } ;
5453 } ,
5554 messageFormatter : null ! ,
You can’t perform that action at this time.
0 commit comments