intelligentplant / AppStoreConnect.Adapters

Allows Intelligent Plant App Store Connect to query 3rd party systems
https://appstore.intelligentplant.com
MIT License
0 stars 0 forks source link

Scoped loggers #376

Closed wazzamatazz closed 5 months ago

wazzamatazz commented 5 months ago

This PR contains breaking changes.

The PR modifies AdapterCore so that it accepts an ILoggerFactory instead of an ILogger. The ILoggerFactory is wrapped in a ScopedLoggerFactory, which sets a scope on every logger that it creates containing the ID of the adapter. Among other things, this is to allow log messages from the adapter and from any helper classes (such as SnapshotTagValueManager) to be easily identified using the logging scope.

AdapterCore.ILogger is now deprecated with a note saying to use the LoggerFactory property instead.

AdapterBase<T> provides new constructors that accept ILoggerFactory instead of ILogger; the constructors that use ILogger are still available but have been marked as deprecated.

Built-in concrete adapter types have been modified to accept ILoggerFactory parameters instead of ILogger<T>.

Helper classes that previously accepted plain ILogger instances now require either an ILogger<T> or an ILoggerFactory.

The adapter host project template has been updated to use Serilog as the logging abstractions implementation.