-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging of send conversions (#214)
* Added logging to IRootToHostConverter * Log send conversion errors --------- Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com> Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
- Loading branch information
1 parent
077ac24
commit 9d6c914
Showing
5 changed files
with
117 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Sdk/Speckle.Connectors.Utils/Extensions/RootObjectBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Speckle.Connectors.Utils.Builders; | ||
using Speckle.Sdk; | ||
|
||
namespace Speckle.Connectors.Utils.Extensions; | ||
|
||
public static class RootObjectBuilderExtensions | ||
{ | ||
public static void LogSendConversionError<T>( | ||
this ILogger<IRootObjectBuilder<T>> logger, | ||
Exception ex, | ||
string objectType | ||
) | ||
{ | ||
LogLevel logLevel = ex switch | ||
{ | ||
SpeckleException => LogLevel.Information, //If it's too noisy, we could demote to LogLevel.Debug | ||
_ => LogLevel.Error | ||
}; | ||
|
||
logger.Log(logLevel, ex, "Conversion of object {objectType} was not successful", objectType); | ||
} | ||
} |