@@ -94,32 +94,28 @@ public void GlobalCleanup()
9494
9595 [ Benchmark ]
9696 public void NoListenerStringInterpolation ( )
97- {
9897#pragma warning disable CA2254 // Template should be a static expression
9998#pragma warning disable CA1848 // Use the LoggerMessage delegates
100- this . loggerWithNoListener . LogInformation ( $ "Hello from { FoodName } { FoodPrice } .") ;
99+ => this . loggerWithNoListener . LogInformation ( $ "Hello from { FoodName } { FoodPrice } .") ;
101100#pragma warning restore CA1848 // Use the LoggerMessage delegates
102101#pragma warning restore CA2254 // Template should be a static expression
103- }
104102
105103 [ Benchmark ]
106104 public void NoListenerExtensionMethod ( )
107- {
108105#pragma warning disable CA1848 // Use the LoggerMessage delegates
109- this . loggerWithNoListener . LogInformation ( "Hello from {Name} {Price}." , FoodName , FoodPrice ) ;
106+ #pragma warning disable CA1873 // Avoid potentially expensive logging
107+ => this . loggerWithNoListener . LogInformation ( "Hello from {Name} {Price}." , FoodName , FoodPrice ) ;
108+ #pragma warning restore CA1873 // Avoid potentially expensive logging
110109#pragma warning restore CA1848 // Use the LoggerMessage delegates
111- }
112110
113111 [ Benchmark ]
114- public void NoListener ( )
115- {
112+ public void NoListener ( ) =>
116113 this . loggerWithNoListener . FoodRecallNotice (
117114 brandName : "Contoso" ,
118115 productDescription : "Salads" ,
119116 productType : "Food & Beverages" ,
120117 recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
121118 companyName : "Contoso Fresh Vegetables, Inc." ) ;
122- }
123119
124120 [ Benchmark ]
125121 public void UnnecessaryIsEnabledCheck ( )
@@ -148,58 +144,46 @@ public void CreateLoggerRepeatedly()
148144 }
149145
150146 [ Benchmark ]
151- public void OneProcessor ( )
152- {
147+ public void OneProcessor ( ) =>
153148 this . loggerWithOneProcessor . FoodRecallNotice (
154149 brandName : "Contoso" ,
155150 productDescription : "Salads" ,
156151 productType : "Food & Beverages" ,
157152 recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
158153 companyName : "Contoso Fresh Vegetables, Inc." ) ;
159- }
160154
161155 [ Benchmark ]
162- public void BatchProcessor ( )
163- {
156+ public void BatchProcessor ( ) =>
164157 this . loggerWithBatchProcessor . FoodRecallNotice (
165158 brandName : "Contoso" ,
166159 productDescription : "Salads" ,
167160 productType : "Food & Beverages" ,
168161 recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
169162 companyName : "Contoso Fresh Vegetables, Inc." ) ;
170- }
171163
172164 [ Benchmark ]
173- public void TwoProcessors ( )
174- {
165+ public void TwoProcessors ( ) =>
175166 this . loggerWithTwoProcessors . FoodRecallNotice (
176167 brandName : "Contoso" ,
177168 productDescription : "Salads" ,
178169 productType : "Food & Beverages" ,
179170 recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
180171 companyName : "Contoso Fresh Vegetables, Inc." ) ;
181- }
182172
183173 [ Benchmark ]
184- public void ThreeProcessors ( )
185- {
174+ public void ThreeProcessors ( ) =>
186175 this . loggerWithThreeProcessors . FoodRecallNotice (
187176 brandName : "Contoso" ,
188177 productDescription : "Salads" ,
189178 productType : "Food & Beverages" ,
190179 recallReasonDescription : "due to a possible health risk from Listeria monocytogenes" ,
191180 companyName : "Contoso Fresh Vegetables, Inc." ) ;
192- }
193181
194- internal sealed class NoopLogProcessor : BaseProcessor < LogRecord >
195- {
196- }
182+ internal sealed class NoopLogProcessor : BaseProcessor < LogRecord > ;
197183
198184 internal sealed class NoopExporter : BaseExporter < LogRecord >
199185 {
200186 public override ExportResult Export ( in Batch < LogRecord > batch )
201- {
202- return ExportResult . Success ;
203- }
187+ => ExportResult . Success ;
204188 }
205189}
0 commit comments