dokany icon indicating copy to clipboard operation
dokany copied to clipboard

Library / Mirror - Allow custom logger set during DokanInit

Open Liryna opened this issue 5 years ago • 5 comments

Change Library / Mirror logger to spdlog Am currently doing a memory filesystem for dokan as samples in c++ and use spdlog as logging library. I feel like it would be a good idea to replace the current log system we have in the library and in the mirror by this library.

It is header only, prettier and more flexible to manage the output type (it does support OutputDebugString)

Does someone have an argument this should not be made ?

ping @Kerbox @Rondom @kyanha

Liryna avatar Nov 22 '19 22:11 Liryna

Or we might just let the user set a function pointer / struct function pointer redirecting to his own logger as talked here: https://github.com/dokan-dev/dokany/pull/845

Liryna avatar Nov 24 '19 08:11 Liryna

I haven't had a chance to evaluate these thoughts as yet. I may not have time until Tuesday November 26. Please wait until then to make a decision.

-Kyle H

On Sun, Nov 24, 2019, 02:47 Liryna [email protected] wrote:

Or we might just let the user set a function pointer redirecting to his own logger as talked here: #845 https://github.com/dokan-dev/dokany/pull/845

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dokan-dev/dokany/issues/851?email_source=notifications&email_token=AABMMFMSJ2VIBVTVUGWVBODQVI5SDA5CNFSM4JQWSCNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFAGQMY#issuecomment-557869107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABMMFNS4ULTOKOE2CTXJX3QVI5SDANCNFSM4JQWSCNA .

kyanha avatar Nov 24 '19 09:11 kyanha

As nice as spdlog is, I think I prefer the idea of being able to provide a struct of logging callback procedures. There's going to be something different that needs to be done to support dokan-dotnet et al. (I will not be averse to the creation of a shallow wrapper for spdlog, but I am averse to trying to compile in spdlog and then enforce customization under its rules.)

For example, if we tried to use spdlog with C#, either the interface DLL would need to be compiled with C++/CLI or a delegate class used to customize spdlog (much like DokanNet.DokanOperationProxy) would need to be written. While it would be possible, it would also be another thing that would need to be supported if spdlog's interface changes at all. Using p/invoke marshaling into a struct allows the user complete control over how it works, in their language of choice. (It may not be as performant, but the C# interface to dokany already takes some simplifying shortcuts that reduce performance.)

I'll have to look at #845 to see if there's anything that strikes me as unworkable for dokan-dotnet usage. This will have to wait a few days, because we're about to have Thanksgiving here in US.

kyanha avatar Nov 28 '19 09:11 kyanha

Now that we have a DokanInit function in v2, we can use it to pass a struct of logging callback to forward all the following library logs an maybe make it public so the mirror can also use do it.

Liryna avatar Jan 06 '22 13:01 Liryna

I can say that the logger we been using dokan.net isn't exactly good and I was thinking serilog could have been a better choice, so I would say as long as it won't tie us to a specific implementation or dependency it's ok

TrabacchinLuigi avatar Mar 20 '22 16:03 TrabacchinLuigi