-
Notifications
You must be signed in to change notification settings - Fork 126
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
split logging from root object #824
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like it. It always puzzled me to have a global root object with dubious memory ownership, though the code appeared safe.
Don't worry too much about global variables, I have a similar mental block for goto
... 😳
If I got you right, the idea is to introduce a global log buffer with multiple readers. This indeed would also solve the issue.
Yeah, let's start with the default global logging fix here and see if anyone is really unhappy with it. We can discuss/play with the two idea (either introducing a library handle or your idea with a log buffer) for libnvme 2.0. |
It was more an idea than any proposal and we don't plan to make use of anything like this in the near term. To be precise, we need multiple root objects to be supported, due to threading. However logging is a different affair, at the moment we basically silence/disable libnvme logging in libblockdev and rely solely on error codes. My only concern is that whenever a root object takes |
Just thought I'd chime in to say that threading is precisely why nvme-stas also requires multiple root objects. |
Sort the entries alphabetically. Signed-off-by: Daniel Wagner <dwagner@suse.de>
Do not distribute the filtering over several places. While at it also make it the arguments a bit more readable. Signed-off-by: Daniel Wagner <dwagner@suse.de>
The original plan was to avoid any global variables in the library. Thus the logging variables were tied to the root object which is available via the fabric API. The default NVME API doesn't have the root object thus we had to add a global variable to set log level etc. But the API to set these variables is done via the root object. This approach enforces the caller side to create an default root object to initialize the default logging level. This introduces unnecessary complexity on the caller side and wastes resources. Let's split the default logging setting from the root object. Signed-off-by: Daniel Wagner <dwagner@suse.de>
Let's refactor the logging out from the root object and accept the full defeat against no global variables fight.