{"action":"created","issue":{"url":"https://api.github.com/repos/TokTok/c-toxcore/issues/487","repository_url":"https://api.github.com/repos/TokTok/c-toxcore","labels_url":"https://api.github.com/repos/TokTok/c-toxcore/issues/487/labels{/name}","comments_url":"https://api.github.com/repos/TokTok/c-toxcore/issues/487/comments","events_url":"https://api.github.com/repos/TokTok/c-toxcore/issues/487/events","html_url":"https://github.com/TokTok/c-toxcore/pull/487","id":211317113,"number":487,"title":"Split daemon's logging backends in separate modules","user":{"login":"nurupo","id":1855294,"avatar_url":"https://avatars2.githubusercontent.com/u/1855294?v=3","gravatar_id":"","url":"https://api.github.com/users/nurupo","html_url":"https://github.com/nurupo","followers_url":"https://api.github.com/users/nurupo/followers","following_url":"https://api.github.com/users/nurupo/following{/other_user}","gists_url":"https://api.github.com/users/nurupo/gists{/gist_id}","starred_url":"https://api.github.com/users/nurupo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nurupo/subscriptions","organizations_url":"https://api.github.com/users/nurupo/orgs","repos_url":"https://api.github.com/users/nurupo/repos","events_url":"https://api.github.com/users/nurupo/events{/privacy}","received_events_url":"https://api.github.com/users/nurupo/received_events","type":"User","site_admin":false},"labels":[{"id":448972317,"url":"https://api.github.com/repos/TokTok/c-toxcore/labels/CAT:code_cleanup","name":"CAT:code_cleanup","color":"fef2c0","default":false},{"id":565614869,"url":"https://api.github.com/repos/TokTok/c-toxcore/labels/PR:in_progress","name":"PR:in_progress","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"Zer0-One","id":1117820,"avatar_url":"https://avatars0.githubusercontent.com/u/1117820?v=3","gravatar_id":"","url":"https://api.github.com/users/Zer0-One","html_url":"https://github.com/Zer0-One","followers_url":"https://api.github.com/users/Zer0-One/followers","following_url":"https://api.github.com/users/Zer0-One/following{/other_user}","gists_url":"https://api.github.com/users/Zer0-One/gists{/gist_id}","starred_url":"https://api.github.com/users/Zer0-One/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zer0-One/subscriptions","organizations_url":"https://api.github.com/users/Zer0-One/orgs","repos_url":"https://api.github.com/users/Zer0-One/repos","events_url":"https://api.github.com/users/Zer0-One/events{/privacy}","received_events_url":"https://api.github.com/users/Zer0-One/received_events","type":"User","site_admin":false},"assignees":[{"login":"Zer0-One","id":1117820,"avatar_url":"https://avatars0.githubusercontent.com/u/1117820?v=3","gravatar_id":"","url":"https://api.github.com/users/Zer0-One","html_url":"https://github.com/Zer0-One","followers_url":"https://api.github.com/users/Zer0-One/followers","following_url":"https://api.github.com/users/Zer0-One/following{/other_user}","gists_url":"https://api.github.com/users/Zer0-One/gists{/gist_id}","starred_url":"https://api.github.com/users/Zer0-One/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zer0-One/subscriptions","organizations_url":"https://api.github.com/users/Zer0-One/orgs","repos_url":"https://api.github.com/users/Zer0-One/repos","events_url":"https://api.github.com/users/Zer0-One/events{/privacy}","received_events_url":"https://api.github.com/users/Zer0-One/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/TokTok/c-toxcore/milestones/22","html_url":"https://github.com/TokTok/c-toxcore/milestone/22","labels_url":"https://api.github.com/repos/TokTok/c-toxcore/milestones/22/labels","id":2137835,"number":22,"title":"v0.1.8","description":"","creator":{"login":"iphydf","id":10647936,"avatar_url":"https://avatars3.githubusercontent.com/u/10647936?v=3","gravatar_id":"","url":"https://api.github.com/users/iphydf","html_url":"https://github.com/iphydf","followers_url":"https://api.github.com/users/iphydf/followers","following_url":"https://api.github.com/users/iphydf/following{/other_user}","gists_url":"https://api.github.com/users/iphydf/gists{/gist_id}","starred_url":"https://api.github.com/users/iphydf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iphydf/subscriptions","organizations_url":"https://api.github.com/users/iphydf/orgs","repos_url":"https://api.github.com/users/iphydf/repos","events_url":"https://api.github.com/users/iphydf/events{/privacy}","received_events_url":"https://api.github.com/users/iphydf/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":9,"state":"open","created_at":"2016-11-15T22:14:27Z","updated_at":"2017-04-12T21:00:27Z","due_on":"2017-04-07T07:00:00Z","closed_at":null},"comments":4,"created_at":"2017-03-02T08:05:16Z","updated_at":"2017-04-12T21:02:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/TokTok/c-toxcore/pulls/487","html_url":"https://github.com/TokTok/c-toxcore/pull/487","diff_url":"https://github.com/TokTok/c-toxcore/pull/487.diff","patch_url":"https://github.com/TokTok/c-toxcore/pull/487.patch"},"body":"- `log_backend.h` defines an interface for logging back-ends, which `log_backend_[stdout|syslog].[h|c]` implement. These implementations are then put together into a `BACKENDS` array in `log.c`, which is indexed by the `LOG_BACKEND` enum. Haven't really done any such modular implementations in C before, so any corrections are welcome.\r\n\r\n- Renamed\r\n  - `open_log()` --> `log_open()`\r\n  - `close_log()` --> `log_close()`\r\n  - `write_log()` --> `log_write()`\r\n\r\n  Should probably have been a separate commit/PR, but I happened to do the renaming and modularization at the same time, so there we go.\r\n\r\nI meant to make logging modular from the beginning, but at the time of writing it I thought that maybe it's simpler to keep all logging backends relatively separate in `log.c` as there is so little code, instead of scattering them in multiple files and adding this struct with function pointers glue, at least until there is more code for the logging that would warrant the splitting, but there was some confusion as to why I want to keep backends relatively separate\r\n\r\n>[The part I don't understand is the \"keeping backends separate\". You still have explicit knowledge of every backend in this function. What is the advantage of having `my_foo(...)` instead of `foo(...)`?](https://github.com/TokTok/c-toxcore/pull/297#issuecomment-267774183)\r\n> -- @iphydf \r\n\r\n, so this PR should remove this confusion now that the logging backends are truly separate.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/toktok/c-toxcore/487)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/TokTok/c-toxcore/issues/comments/293706644","html_url":"https://github.com/TokTok/c-toxcore/pull/487#issuecomment-293706644","issue_url":"https://api.github.com/repos/TokTok/c-toxcore/issues/487","id":293706644,"user":{"login":"iphydf","id":10647936,"avatar_url":"https://avatars3.githubusercontent.com/u/10647936?v=3","gravatar_id":"","url":"https://api.github.com/users/iphydf","html_url":"https://github.com/iphydf","followers_url":"https://api.github.com/users/iphydf/followers","following_url":"https://api.github.com/users/iphydf/following{/other_user}","gists_url":"https://api.github.com/users/iphydf/gists{/gist_id}","starred_url":"https://api.github.com/users/iphydf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iphydf/subscriptions","organizations_url":"https://api.github.com/users/iphydf/orgs","repos_url":"https://api.github.com/users/iphydf/repos","events_url":"https://api.github.com/users/iphydf/events{/privacy}","received_events_url":"https://api.github.com/users/iphydf/received_events","type":"User","site_admin":false},"created_at":"2017-04-12T21:02:10Z","updated_at":"2017-04-12T21:02:10Z","body":"I'm ok with this change. In fact, I really don't care about the bootstrap daemon's logging backend design. Are we going to merge this?"}}
{"actor":{"display_login":"iphydf"}}