nHapiNET / nHapi

nHapi is the .Net port of the original Java project HAPI.
Mozilla Public License 2.0
266 stars 155 forks source link

Support inserting custom logging framework #282

Open fredrikcarlbom opened 2 years ago

fredrikcarlbom commented 2 years ago

Is your feature request related to a problem? Please describe. We are considering using nHapi in our product but since it writes its logs using a custom log framework that is a drawback.

Describe the solution you'd like Supporting Microsoft.Extensions.Logging.Abstractions.ILoggerFactory would be ideal the ideal solution. This would also require implementing a default LoggerFactory that behaves like the current logging does

Describe alternatives you've considered Using the current framework with trace listeners and output using the same format as our application.

Additional context This would require dropping NET 3.5 support since Standard 2.0/Framework 4.6.1 is required.

milkshakeuk commented 2 years ago

@fredrikcarlbom Sounds like an excellent idea to me, though as it stands at the moment there isn't an army of people to pick these feature requests up, interested in supporting such a feature request?

In regards to your idea, I like it, I don't think nhapi.base should take a direct dependency on Microsoft.Extensions.Logging.Abstractions it should probably have its own ILogger interface which would expose an api very similar if not identical to microsofts ILogger interface, it should have a simple base implementation which could even be a null logger similar to NullLogger.

There could then be a separate nhapi.extensions.logging package which would be a simple adaptor for microsoft.extensions.logging.

What do you think?

@duaneedwards @AMCN41R what do you think?

fredrikcarlbom commented 2 years ago

@milkshakeuk Your solution sounds reasonable. I can't promise that I can help out with this or not, we have not made any final decision to go with nHapi.

milkshakeuk commented 2 years ago

@milkshakeuk Your solution sounds reasonable. I can't promise that I can help out with this or not, we have not made any final decision to go with nHapi.

@fredrikcarlbom did you ever make a decision?

milkshakeuk commented 1 year ago

https://xfischer.github.io/logging-dotnet-core/