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

Log redirection (v2.0) #845

Open
wants to merge 5 commits into
base: Corillian-asyncio
Choose a base branch
from

Conversation

Karandra
Copy link

@Karandra Karandra commented Nov 4, 2019

Adds log redirection options.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the existing documentation
  • My changes generate no new warnings
  • I have updated the change log (Add/Change/Fix)
  • I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

Currently there is no way to make Dokany log its operation to user-defined target. There is an option to use stderr instead of OutputDebugStringA/W but that might not be desirable to the library user.

I've added a struct with two function to be provided by the library user that will take formatted debug string and return a BOOL value which indicated in Dokany should proceed with its own debug output. The value is TRUE by default so in case the used didn't provide any log redirection function the library will output log itself.

@Karandra Karandra changed the title Log redirection Log redirection (v2.0) Nov 4, 2019
@Karandra
Copy link
Author

Karandra commented Nov 4, 2019

Sorry, I'm idiot and couldn't find all places with DokanInit at once.

@Karandra
Copy link
Author

Karandra commented Nov 4, 2019

Now it has been built successfully.

@Liryna
Copy link
Member

Liryna commented Nov 4, 2019

Hi @KerberX ,

That's a good idea! Look at the function pointer, would it not be better to directly call the user function instead of our ? This way he will manage as he wants how to log it.

Like DokanDbgPrint would create the debug output and then call PDokanDbgPrint -> return Or follow the current output path.

@Karandra
Copy link
Author

Karandra commented Nov 4, 2019

Yeah, that would be better indeed. I'll make the changes.

Could it be possible to implement such thing for v1.x? As far as I know there is no global Init/Shutdown routine that can initialize logging functions.

@Liryna
Copy link
Member

Liryna commented Nov 4, 2019

It can be possible to implement it yes at mount time.
This makes me think we should (my point of view) maybe add a param to inform from which instance this log comes from ?
Or maybe not use global function pointers but function pointer attached to the instance.
I agree this is more than this PR as it is already the case to log all instances at the same place 😃

@Karandra
Copy link
Author

Karandra commented Nov 4, 2019

Or maybe not use global function pointers but function pointer attached to the instance.

In the same fashion as operation callbacks? I'd like that solution.

@Liryna
Copy link
Member

Liryna commented Nov 4, 2019

Yes this way but maybe not directly to the dokanoperations 😄

@Liryna
Copy link
Member

Liryna commented Jan 6, 2022

The new V2 has a new mandatory API named DokanInit.
@Karandra if you are still interested, it would be great if you could port your work by using the API to register the struct logging functions.

@Karandra
Copy link
Author

Karandra commented Jan 6, 2022

I'll see what I can do. I still need to see has been changed between that version and the current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants