File tree Expand file tree Collapse file tree
Diagnostics/PostSharp.Samples.Logging.BusinessLogic Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . Threading ;
33using PostSharp . Patterns . Diagnostics ;
4+ using static PostSharp . Patterns . Diagnostics . FormattedMessageBuilder ;
45
56namespace PostSharp . Samples . Logging . BusinessLogic
67{
78 public class QueueProcessor
89 {
9- private static readonly Logger logger = Logger . GetLogger ( ) ;
10+ private static readonly LogSource logSource = LogSource . Get ( ) ;
1011
1112 public static void ProcessQueue ( string queuePath )
1213 {
@@ -19,14 +20,14 @@ public static void ProcessQueue(string queuePath)
1920
2021 private static void ProcessItem ( QueueItem item )
2122 {
22- var activity = logger . OpenActivity ( "Processing item {item}" , item ) ;
23+ var activity = logSource . Default . OpenActivity ( Formatted ( "Processing item {item}" , item ) ) ;
2324 try
2425 {
2526 var request = RequestStorage . GetRequest ( item . Id ) ;
2627
2728 if ( item . Id == 56 )
2829 {
29- activity . Write ( LogLevel . Warning , "The entity {id} has been marked for deletion." , item . Id ) ;
30+ logSource . Warning . Write ( Formatted ( "The entity {id} has been marked for deletion." , item . Id ) ) ;
3031 activity . SetSuccess ( ) ;
3132 return ;
3233 }
You can’t perform that action at this time.
0 commit comments