-
Notifications
You must be signed in to change notification settings - Fork 291
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
Move logging to a callback. #46
Conversation
04941f8
to
b868b27
Compare
@linux-modder you were talking about community reviews. This change is a good one to test your process on. |
OK. First time using reviewable... Anyways, seems like it will require more effort to write them log messages but an overall a positive change. Comments from Reviewable |
@@ -144,7 +144,8 @@ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string | |||
} | |||
|
|||
if (end_len != string - old_str) { | |||
LOGGER_ERROR("tox_generate_dns3_string Fail, %u != %lu\n", end_len, string - old_str); | |||
// This currently has no access to a logger. |
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.
It would be nice to add a "FIXME:" for easier grepability
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.
Done.
Reviewed 38 of 38 files at r1, 6 of 6 files at r2, 3 of 3 files at r3. Comments from Reviewable |
Review status: 31 of 37 files reviewed at latest revision, 5 unresolved discussions. toxav/bwcontroller.c, line 158 [r1] (raw file):
Why is messenger's logger used in here? Does this function run in messenger's thread? Is the log callback in toxcore/logger.c, line 67 [r1] (raw file):
so we would know exactly how much space to allcoate on the heap. toxcore/tox.c, line 133 [r1] (raw file):
Should it really be random? We could keep a global counter ourselves, or let the user pass an integer to Actually, do we even need that integer? What is the purpose of it? A user would be able to know which Tox instance is calling the log callback because the callback would have the Comments from Reviewable |
Reviewed 38 of 38 files at r1. toxav/bwcontroller.c, line 158 [r1] (raw file):
|
Reviewed 6 of 6 files at r2, 3 of 3 files at r3, 6 of 6 files at r4. Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. toxav/bwcontroller.c, line 158 [r1] (raw file):
|
8d26cb6
to
d3a1537
Compare
toxcore/logger.c, line 67 [r1] (raw file):
|
toxcore/tox.c, line 133 [r1] (raw file):
|
Reviewed 4 of 4 files at r6. toxcore/logger.h, line 66 [r6] (raw file):
Alternatively, why not make the log level a run-time option, so that a client could select the logging level, since no code seems to be compiled-out anyway and also because with the way this PR is now, the same client would have different logs depending on how the toxcore was built. Also, what about a getter function for the client to know the logging level toxcore uses, would that be useful? Comments from Reviewable |
This removes the global logger (which by the way was deleted when the first tox was killed, so other toxes would then stop logging). Various bits of the code now carry a logger or pass it around. It's a bit less transparent now, but now there is no need to have a global logger, and clients can decide what to log and where.
Review status: all files reviewed at latest revision, 4 unresolved discussions. toxcore/logger.h, line 66 [r6] (raw file):
|
Review status: all files reviewed at latest revision, 4 unresolved discussions. toxcore/logger.h, line 66 [r6] (raw file):
Ok, didn't realize that. Then it's good.
I don't have a strong opinion about it being a compile-time or run-time. I guess compile-time is somewhat mobile-friendly, less cpu cycles and battery usage (and tux3 has this dead-slow laptop he likes to run stuff on :P), so I'm more inclined for compile-time. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions. toxcore/logger.h, line 67 [r7] (raw file):
Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions. toxcore/logger.h, line 67 [r7] (raw file):
|
Reviewed 1 of 4 files at r6. Comments from Reviewable |
Reviewed 23 of 38 files at r1, 1 of 3 files at r3, 1 of 6 files at r4, 8 of 9 files at r5, 3 of 4 files at r6. Comments from Reviewable |
Reviewed 1 of 3 files at r3, 1 of 6 files at r4, 8 of 9 files at r5, 4 of 4 files at r6. Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions. Comments from Reviewable |
This removes the global logger (which by the way was deleted when the first tox
was killed, so other toxes would then stop logging). Various bits of the code
now carry a logger or pass it around. It's a bit less transparent now, but now
there is no need to have a global logger, and clients can decide what to log and
where.
This change is