Browse Source
Improve logging of exceptions by ensuring error codes and details are not null or whitespace
pull/22339/head
maliming
11 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
2 additions and
2 deletions
-
framework/src/Volo.Abp.Core/Microsoft/Extensions/Logging/AbpLoggerExtensions.cs
|
|
|
@ -70,12 +70,12 @@ public static class AbpLoggerExtensions |
|
|
|
|
|
|
|
private static void LogKnownProperties(ILogger logger, Exception exception, LogLevel logLevel) |
|
|
|
{ |
|
|
|
if (exception is IHasErrorCode exceptionWithErrorCode) |
|
|
|
if (exception is IHasErrorCode exceptionWithErrorCode && !exceptionWithErrorCode.Code.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
logger.LogWithLevel(logLevel, "Code:" + exceptionWithErrorCode.Code); |
|
|
|
} |
|
|
|
|
|
|
|
if (exception is IHasErrorDetails exceptionWithErrorDetails) |
|
|
|
if (exception is IHasErrorDetails exceptionWithErrorDetails && !exceptionWithErrorDetails.Details.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
logger.LogWithLevel(logLevel, "Details:" + exceptionWithErrorDetails.Details); |
|
|
|
} |
|
|
|
|