@@ -31,6 +31,9 @@ public static void Initialise(ILogger loggerObject) {
3131 Logger . IsInitialised = true ;
3232 }
3333
34+ private const String CorrelationIdPropertyName = "correlationId" ;
35+ private const String TenantIdPropertyName = "tenantId" ;
36+
3437 public static void LogCritical ( Exception exception ) {
3538 ValidateLoggerObject ( ) ;
3639
@@ -40,13 +43,13 @@ public static void LogCritical(Exception exception) {
4043 LoggerObject . LogCritical ( exception ) ;
4144 return ;
4245 }
43- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
46+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
4447 // Write to the normal log
4548 LoggerObject . LogCritical ( exception ) ;
4649
4750 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
4851 // Write to the tenant log
49- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
52+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
5053 LoggerObject . LogCritical ( exception ) ;
5154 }
5255 }
@@ -63,13 +66,13 @@ public static void LogDebug(String message) {
6366 return ;
6467 }
6568
66- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
69+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
6770 // Write to the normal log
6871 LoggerObject . LogDebug ( message ) ;
6972
7073 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
7174 // Write to the tenant log
72- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
75+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
7376 LoggerObject . LogDebug ( message ) ;
7477 }
7578 }
@@ -86,13 +89,13 @@ public static void LogError(Exception exception) {
8689 return ;
8790 }
8891
89- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
92+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
9093 // Write to the normal log
9194 LoggerObject . LogError ( exception ) ;
9295
9396 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
9497 // Write to the tenant log
95- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
98+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
9699 LoggerObject . LogError ( exception ) ;
97100 }
98101 }
@@ -108,13 +111,13 @@ public static void LogError(String message,
108111 LoggerObject . LogError ( message , exception ) ;
109112 return ;
110113 }
111- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
114+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
112115 // Write to the normal log
113116 LoggerObject . LogError ( message , exception ) ;
114117
115118 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
116119 // Write to the tenant log
117- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
120+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
118121 LoggerObject . LogError ( message , exception ) ;
119122 }
120123 }
@@ -129,13 +132,13 @@ public static void LogInformation(String message) {
129132 Logger . LoggerObject . LogInformation ( message ) ;
130133 return ;
131134 }
132- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
135+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
133136 // Write to the normal log
134137 Logger . LoggerObject . LogInformation ( message ) ;
135138
136139 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
137140 // Write to the tenant log
138- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
141+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
139142 Logger . LoggerObject . LogInformation ( message ) ;
140143 }
141144 }
@@ -150,13 +153,13 @@ public static void LogTrace(String message) {
150153 Logger . LoggerObject . LogTrace ( message ) ;
151154 return ;
152155 }
153- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
156+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
154157 // Write to the normal log
155158 Logger . LoggerObject . LogTrace ( message ) ;
156159
157160 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
158161 // Write to the tenant log
159- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
162+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
160163 Logger . LoggerObject . LogTrace ( message ) ;
161164 }
162165 }
@@ -171,13 +174,13 @@ public static void LogWarning(String message) {
171174 Logger . LoggerObject . LogWarning ( message ) ;
172175 return ;
173176 }
174- using ( ScopeContext . PushProperty ( "correlationId" , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
177+ using ( ScopeContext . PushProperty ( CorrelationIdPropertyName , $ "Correlation ID: { tenantContext . CorrelationId . ToString ( ) } ") ) {
175178 // Write to the normal log
176179 Logger . LoggerObject . LogWarning ( message ) ;
177180
178181 if ( tenantContext . PerTenantLogsEnabled && tenantContext . EstateId != Guid . Empty ) {
179182 // Write to the tenant log
180- using ( ScopeContext . PushProperty ( "tenantId" , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
183+ using ( ScopeContext . PushProperty ( TenantIdPropertyName , $ "_{ tenantContext . EstateId . ToString ( ) } ") ) {
181184 Logger . LoggerObject . LogWarning ( message ) ;
182185 }
183186 }
0 commit comments