Mr-Markus / ZigbeeNet

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

Log refactor #153

Closed oblaise closed 3 years ago

oblaise commented 3 years ago

This PR replaces Serilog by Microsoft.Extension.Logging.Abstractions in libraries as explained in issue #146.

I slightly modified the ZigBeeNet.PlayGround sample to show the possibility to use different logging providers. In the current state on GitHub it uses Serilog for console output as it is output is nicer than Microsoft.Extension.Logging.Console. You can easily switch to the other one by modifying the UseSerilog property in the ZigBeeNet.PlayGround.csproj file:

  <PropertyGroup>
    <!-- If True use Serilog, if False use Microsoft.Extension.Logging.Console -->
    <UseSerilog>True</UseSerilog>
  </PropertyGroup>

Any provider compatible with the Microsoft.Extensions.Logging should now be compatible with the logging in ZigBeeNet* libraries.

Mr-Markus commented 3 years ago

Thanks!

I think Code Generator should be run, before this PR will be merged. Have you already done this locally?

oblaise commented 3 years ago

Yes I run the ZigBeeNet.Digi.XBee.CodeGenerator that is the only changed code generator.

The change has an impact only on two files: XBeeEventFactory.cs and XBeeResponseFactory.cs. These files are updated in the PR.

For other files generated there is no change - except the version in the header - so for limiting the number of changed files in the PR I only included the changed files.

All these changes are in commit 708b386.

Mr-Markus commented 3 years ago

Great. Thanks for that information