Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library / Mirror - Allow custom logger set during DokanInit #851

Open
Liryna opened this issue Nov 22, 2019 · 5 comments
Open

Library / Mirror - Allow custom logger set during DokanInit #851

Liryna opened this issue Nov 22, 2019 · 5 comments

Comments

@Liryna
Copy link
Member

Liryna commented Nov 22, 2019

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
Copy link
Member Author

Liryna commented Nov 24, 2019

Or we might just let the user set a function pointer / struct function pointer redirecting to his own logger as talked here:
#845

@kyanha
Copy link
Contributor

kyanha commented Nov 24, 2019 via email

@kyanha
Copy link
Contributor

kyanha commented Nov 28, 2019

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.

@Liryna
Copy link
Member Author

Liryna commented Jan 6, 2022

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.

@TrabacchinLuigi
Copy link

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

@Liryna Liryna changed the title Library / Mirror - Change logger to spdlog Library / Mirror - Allow custom logger set during DokanInit Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants