99using Microsoft . Extensions . Logging . EventLog ;
1010using MyMain ;
1111
12-
1312#if FilterCode
1413#region snippet_FilterInCode
1514 public class Program
@@ -18,10 +17,11 @@ public static void Main(string[] args)
1817 {
1918 CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
2019 }
20+
2121 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
2222 Host . CreateDefaultBuilder ( args )
23- . ConfigureLogging ( log =>
24- log . AddFilter ( "System" , LogLevel . Debug )
23+ . ConfigureLogging ( logging =>
24+ logging . AddFilter ( "System" , LogLevel . Debug )
2525 . AddFilter < DebugLoggerProvider > ( "Microsoft" , LogLevel . Information )
2626 . AddFilter < ConsoleLoggerProvider > ( "Microsoft" , LogLevel . Trace ) )
2727 . ConfigureWebHostDefaults ( webBuilder =>
@@ -39,31 +39,29 @@ public static void Main(string[] args)
3939 {
4040 CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
4141 }
42+
4243 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
4344 Host . CreateDefaultBuilder ( args )
44- . ConfigureLogging ( logBuilder =>
45+ . ConfigureLogging ( logging =>
4546 {
46- logBuilder . AddFilter ( ( provider , category , logLevel ) =>
47+ logging . AddFilter ( ( provider , category , logLevel ) =>
4748 {
4849 if ( provider . Contains ( "ConsoleLoggerProvider" )
4950 && category . Contains ( "Controller" )
50- && logLevel >= LogLevel . Information
51- )
51+ && logLevel >= LogLevel . Information )
5252 {
5353 return true ;
5454 }
5555 else if ( provider . Contains ( "ConsoleLoggerProvider" )
5656 && category . Contains ( "Microsoft" )
57- && logLevel >= LogLevel . Information
58- )
57+ && logLevel >= LogLevel . Information )
5958 {
6059 return true ;
6160 }
6261 else
6362 {
6463 return false ;
6564 }
66-
6765 } ) ;
6866 } )
6967 . ConfigureWebHostDefaults ( webBuilder =>
@@ -81,6 +79,7 @@ public static void Main(string[] args)
8179 {
8280 CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
8381 }
82+
8483 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
8584 Host . CreateDefaultBuilder ( args )
8685 . ConfigureLogging ( logging => logging . SetMinimumLevel ( LogLevel . Warning ) )
@@ -99,6 +98,7 @@ public static void Main(string[] args)
9998 {
10099 CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
101100 }
101+
102102 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
103103 Host . CreateDefaultBuilder ( args )
104104 . ConfigureLogging ( ( hostingContext , logging ) =>
@@ -127,18 +127,18 @@ public static void Main(string[] args)
127127
128128 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
129129 Host . CreateDefaultBuilder ( args )
130- . ConfigureLogging ( logging => logging . AddAzureWebAppDiagnostics ( ) )
131- . ConfigureServices ( serviceCollection => serviceCollection
132- . Configure < AzureFileLoggerOptions > ( options =>
133- {
134- options . FileName = "azure-diagnostics-" ;
135- options . FileSizeLimit = 50 * 1024 ;
136- options . RetainedFileCountLimit = 5 ;
137- } ) . Configure < AzureBlobLoggerOptions > ( options =>
138- {
139- options . BlobName = "log.txt" ;
140- } )
141- )
130+ . ConfigureLogging ( logging => logging . AddAzureWebAppDiagnostics ( ) )
131+ . ConfigureServices ( serviceCollection => serviceCollection
132+ . Configure < AzureFileLoggerOptions > ( options =>
133+ {
134+ options . FileName = "azure-diagnostics-" ;
135+ options . FileSizeLimit = 50 * 1024 ;
136+ options . RetainedFileCountLimit = 5 ;
137+ } )
138+ . Configure < AzureBlobLoggerOptions > ( options =>
139+ {
140+ options . BlobName = "log.txt" ;
141+ } ) )
142142 . ConfigureWebHostDefaults ( webBuilder =>
143143 {
144144 webBuilder . UseStartup < Startup > ( ) ;
@@ -158,13 +158,13 @@ public static void Main(string[] args)
158158
159159 public static IHostBuilder CreateHostBuilder ( string [ ] args ) =>
160160 Host . CreateDefaultBuilder ( args )
161- . ConfigureLogging ( logging =>
162- {
163- logging . AddEventLog ( eventLogSettings =>
161+ . ConfigureLogging ( logging =>
164162 {
165- eventLogSettings . SourceName = "MyLogs" ;
166- } ) ;
167- } )
163+ logging . AddEventLog ( eventLogSettings =>
164+ {
165+ eventLogSettings . SourceName = "MyLogs" ;
166+ } ) ;
167+ } )
168168 . ConfigureWebHostDefaults ( webBuilder =>
169169 {
170170 webBuilder . UseStartup < Startup > ( ) ;
0 commit comments