MTConnect.NET icon indicating copy to clipboard operation
MTConnect.NET copied to clipboard

Added logging that helped me a lot with debugging automated tests.

Open SergeyGulik opened this issue 1 year ago • 2 comments

Hi Patrick,

We discussed it long-long ago, but I have forgotten to add these logging statements. Please feel free to accept them partially. Also, pay attention to MTConnectHttpServer.cs

            if (_logger != null)
            {
                serverConfig.DebugLogHandler += (string message, string logtaskid, object data)
                    => _logger.LogDebug($"[{logtaskid}] message: {message}, data: {data}");
            }

It definitely served my purpose, but there might be smarter and more elegant way to do it.

SergeyGulik avatar Oct 16 '24 06:10 SergeyGulik

Hi Patrick!

Any news on this PR? If you are in doubt about merging it, that's ok as well. I will just keep my changes separately and apply them only for debugging.

BTW, what about releasing a new nuget packages? With or without logging it will help me a lot.

Best wishes, Sergii Gulyk

SergeyGulik avatar Oct 21 '24 09:10 SergeyGulik

I'm looking at whether or not to pass a logger as you have in this or to just raise an event. I have previously just raised an event for logging and then have the Agent/Adapter/Client application subscribe to the events and use NLog to actually handle logging. I'll have time to review this further next week.

Yes I'm working on a new release this week that will include the other PRs as well as the updates for MTConnect v2.4 and I will publish new Nuget packages as well.

PatrickRitchie avatar Oct 21 '24 20:10 PatrickRitchie