30
30
//---------------------------------------------------------------------------
31
31
32
32
using System ;
33
+ using System . Diagnostics . CodeAnalysis ;
33
34
using System . Diagnostics . Tracing ;
34
35
35
36
namespace RabbitMQ . Client . Logging
36
37
{
37
38
[ EventSource ( Name = "rabbitmq-dotnet-client" ) ]
38
- public sealed class RabbitMqClientEventSource : EventSource
39
+ internal sealed partial class RabbitMqClientEventSource : EventSource
39
40
{
40
41
public class Keywords
41
42
{
@@ -46,7 +47,7 @@ public RabbitMqClientEventSource() : base(EventSourceSettings.EtwSelfDescribingE
46
47
{
47
48
}
48
49
49
- public static RabbitMqClientEventSource Log = new RabbitMqClientEventSource ( ) ;
50
+ public static readonly RabbitMqClientEventSource Log = new RabbitMqClientEventSource ( ) ;
50
51
51
52
[ Event ( 1 , Message = "INFO" , Keywords = Keywords . Log , Level = EventLevel . Informational ) ]
52
53
public void Info ( string message )
@@ -70,11 +71,6 @@ public void Error(string message, RabbitMqExceptionDetail ex)
70
71
#if NET6_0_OR_GREATER
71
72
WriteExceptionEvent ( message , ex ) ;
72
73
73
- [ UnconditionalSuppressMessage ( "Trimming" , "IL2026" , Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute." ) ]
74
- void WriteExceptionEvent < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicProperties ) ] T > ( string message , T ex )
75
- {
76
- WriteEvent ( 3 , message , ex ) ;
77
- }
78
74
#else
79
75
WriteEvent ( 3 , message , ex ) ;
80
76
#endif
@@ -86,5 +82,13 @@ public void Error(string message, Exception ex)
86
82
{
87
83
Error ( message , new RabbitMqExceptionDetail ( ex ) ) ;
88
84
}
85
+
86
+ #if NET6_0_OR_GREATER
87
+ [ UnconditionalSuppressMessage ( "Trimming" , "IL2026" , Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute." ) ]
88
+ private void WriteExceptionEvent < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicProperties ) ] T > ( string message , T ex )
89
+ {
90
+ WriteEvent ( 3 , message , ex ) ;
91
+ }
92
+ #endif
89
93
}
90
94
}
0 commit comments