Industrial-IoT
Industrial-IoT copied to clipboard
Dependency on SeriLog: why not use Microsoft.Extensions.Logging.Abstractions?
Is your feature request related to a problem? Please describe. When using the API's for the twin/publisher etc, I'm pretty much forced to use the SeriLog logging framework. I'm wondering why the Microsoft.Extensions.Logging.Abstractions is not used, as it seems to me this abstraction is a bit more neutral.
Describe the solution you'd like Instead of being forced to use SeriLog, I would like to use the "neutral" Microsoft.Extensions.Logging.Abstractions definitions.
Describe alternatives you've considered N.A.
Additional context N.A.
@bald123 are you using the REST API calls or are you referring to the edge modules? Can you describe the scenario/use case in a bit more detail?
I'm using the API's to call the microservices in the cloud. For example, when I want to call the REST microservice for the OPC Publisher, I'm using the class "PublisherServiceClient", with the following constructors:
public PublisherServiceClient(IHttpClient httpClient, IPublisherConfig config, ISerializer serializer) : this(httpClient, config?.OpcUaPublisherServiceUrl, serializer) { }
public PublisherServiceClient(IHttpClient httpClient, string serviceUri, ISerializer serializer) { if (string.IsNullOrWhiteSpace(serviceUri)) { throw new ArgumentNullException(nameof(serviceUri), "Please configure the Url of the endpoint micro service."); } _serializer = serializer ?? new NewtonSoftJsonSerializer(); _serviceUri = serviceUri.TrimEnd('/'); _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); }
To inject the IHttpClient, I'm using the Microsoft.Azure.IIoT.Http.Default.HttpClient. This client has the following constructors:
public HttpClient(**ILogger** logger) : this(null, logger) { }
public HttpClient(IHttpClientFactory factory, **ILogger** logger) { _factory = factory ?? new HttpClientFactory(null, logger); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; }
I'm not able to use the Microsoft.Azure.IIoT.Http.Default.HttpClient without using SeriLog.