-
Notifications
You must be signed in to change notification settings - Fork 132
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: Introduce nvme_get_logging_level() #782
Conversation
The idea behind this is to temporarily pause logging (save-override-restore) for operations that are expected to fail. |
This is essentially a getter for nvme_init_logging() since nvme_root_t is an opaque struct. Takes optional pointer to bool args to retrieve PID and timestamp logging values. Signed-off-by: Tomas Bzatek <[email protected]>
When logging has not been initialized and no root available, logging via nvme_msg() would just print everything. Better to check against DEFAULT_LOGLEVEL in such cases. Signed-off-by: Tomas Bzatek <[email protected]>
Added one more change to fix the scenario where e.g. nvme-cli plugins have not initialized logging (since there's no
|
TBH, I think we creating a big mess with the logging. It's getting messier with every commit. Why should the default log level be checked when the root object exists? And what about disabling it on global level, what happens with any existing root object? These are just small 'smells' which tell me that this is going wrong. It's not this particular change. I don't have a good idea what to do. Maybe all function which don't take a root object not print anything at all. |
Both of my commits are rather nice-to-have hacks trying to sneak in an existing infrastructure. On a second thought, you're right, there's more weirdness going on. For start, the symbol naming is inconsistent: Another issue is that while you may call
We would still like to have e.g. the nbft parser high-severity messages printed. The global static root ( |
I'll have a stab if we can improve this. Anyway, your changes itself look okay but as we discussed there is a bit of a mess around the logging infra. I guess we can't avoid having a global variable for the logging, because there is too much code which wants to print debug/error stuff. |
The situation in libnvme wasn't that bad I had in memory. Just the recently debug code was not good. I've dropped this and picked up these changes in #788. |
Nice, thanks! |
This is essentially a getter for
nvme_init_logging()
sincenvme_root_t
is an opaque struct. Takes optional pointer to bool args to retrieve PID and timestamp logging values.