-
Notifications
You must be signed in to change notification settings - Fork 23
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
refactor: Simplification of output debug messages #154
refactor: Simplification of output debug messages #154
Conversation
src/common.h
Outdated
@@ -8,6 +8,12 @@ | |||
#define __DCURL_MINOR__ 1 | |||
#define __DCURL_PATCH__ 0 | |||
|
|||
#if defined(ENABLE_DEBUG) | |||
#define DPRINTF(...) printf(__VA_ARGS__) |
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.
Eventually, dprintf
might be conjuncted with logging facilities such as something in entangle
. I would expect there is no direct call to printf
.
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.
Lower-case dprintf
is better than the opposite form DPRINTF
.
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.
Eventually,
dprintf
might be conjuncted with logging facilities such as something inentangle
. I would expect there is no direct call toprintf
.
I guess it will be left to the future modification?
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.
We can proceed at the moment since it could be involved in small chunks of changes.
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.
I found the logging function of entangled
: log_debug()
static inline void dprintf(...) {
#if defined(ENABLE_DEBUG)
log_debug();
#endif
}
void log_debug() {
// The current dcurl implementation would be printf()
// In the future,
// it might be integrated with other logging facilities like entangled
printf(...);
}
Is this what you expected to see?
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.
selftest
programs inside Linux kernel tree come with a nice example for writing dprintf: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/x86/pkey-helpers.h
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.
Since dprintf()
has been declared in stdio.h, I rename it to dbgprintf()
instead.
2342bac
to
dc04719
Compare
dc04719
to
4f0c94d
Compare
Close #153.