Mr-Markus / ZigbeeNet

A .NET Standard library for working with ZigBee
Eclipse Public License 1.0
131 stars 47 forks source link

Most of log statements in catch blocks do not log the exception #78

Closed spudwebb closed 4 years ago

spudwebb commented 5 years ago

For example:

Log.Error("Synchronous command send failed due to unexpected exception.", ex);

will not log the exception as there is no parameter in the message template. So we should replace it with:

Log.Error("Synchronous command send failed due to unexpected exception. {Exception}", ex);

or I saw that Serilog also have methods that takes an exception as the first parameter:

public static void Error(Exception exception, string messageTemplate);

but I'm not sure how it works.