- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Task/#343 split out logger #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|  | @@ -8,7 +8,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ExcludeFromCodeCoverage] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static class Logger { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private static ILogger LoggerObject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check warning on line 11 in Shared.Logger/Logger.cs 
     | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static Boolean IsInitialised { get; set; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -36,6 +36,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogCritical(exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogCritical(exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -47,11 +51,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public static void LogDebug(String message) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogDebug(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogDebug(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -69,6 +80,12 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogError(exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogError(exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -87,6 +104,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogError(message, exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoggerObject.LogError(message, exception); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -104,6 +125,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogInformation(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check failureCode scanning / CodeQL Log entries created from user input High 
      This log entry depends on a  user-provided value                Error loading related location      Loading This log entry depends on a user-provided value                Error loading related location      Loading This log entry depends on a user-provided value                Error loading related location      Loading This log entry depends on a user-provided value                Error loading related location      Loading Copilot AutofixAI 4 months ago Copilot could not generate an autofix suggestion Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogInformation(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -121,6 +146,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogTrace(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check failureCode scanning / CodeQL Log entries created from user input High 
      This log entry depends on a  user-provided value                Error loading related location      Loading This log entry depends on a user-provided value                Error loading related location      Loading           Copilot AutofixAI 4 months ago To fix the issue, we need to sanitize the  
  Suggested changeset
  1
 
      
    Shared/Middleware/Helpers.cs
     
            Outside changed files
           
 
 
                  Copilot is powered by AI and may make mistakes. Always verify output.
                 Positive FeedbackNegative Feedback 
                  
                  Refresh and try again.
                 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogTrace(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | @@ -138,6 +167,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValidateLoggerObject(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TenantContext tenantContext = TenantContext.CurrentTenant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (tenantContext == null) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogWarning(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check failureCode scanning / CodeQL Log entries created from user input High 
      This log entry depends on a  user-provided value                Error loading related location      Loading This log entry depends on a user-provided value                Error loading related location      Loading           Copilot AutofixAI 4 months ago To fix the issue, we need to sanitize the  The sanitization should be applied consistently across all logging methods ( 
  Suggested changeset
  2
 
      
    Shared.Logger/Logger.cs
     
 
 
      
    Shared/Middleware/Helpers.cs
     
            Outside changed files
           
 
 
                  Copilot is powered by AI and may make mistakes. Always verify output.
                 Positive FeedbackNegative Feedback 
                  
                  Refresh and try again.
                 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using (ScopeContext.PushProperty("correlationId", $"Correlation ID: {tenantContext.CorrelationId.ToString()}")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Write to the normal log | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Logger.LoggerObject.LogWarning(message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure
Code scanning / CodeQL
Log entries created from user input High
Copilot Autofix
AI 4 months ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.