{"action":"created","comment":{"url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/comments/71960467","id":71960467,"diff_hunk":"@@ -0,0 +1,84 @@\n+/** @file\n+    @brief Regstry to maintain instantiated loggers and global settings.\n+\n+    @date 2016\n+\n+    @author\n+    Sensics, Inc.\n+    <http://sensics.com>\n+\n+*/\n+\n+// Copyright 2016 Sensics, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// \thttp://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#ifndef INCLUDED_LogRegistry_h_GUID_09DDD840_389E_430C_8CBD_9AC4EE3F93FE\n+#define INCLUDED_LogRegistry_h_GUID_09DDD840_389E_430C_8CBD_9AC4EE3F93FE\n+\n+// Internal Includes\n+#include <osvr/Util/LogLevel.h>\n+\n+// Library/third-party includes\n+// - none\n+\n+// Standard includes\n+#include <memory>           // for std::shared_ptr\n+#include <string>           // for std::string\n+#include <vector>           // for std::vector\n+\n+// Forward declarations\n+namespace spdlog {\n+\n+    namespace sinks {\n+        class sink;\n+    } // namespace sinks\n+\n+    using sink_ptr = std::shared_ptr<spdlog::sinks::sink>;\n+\n+} // namespace spdlog\n+\n+namespace osvr {\n+namespace util {\n+namespace log {\n+\n+    class Logger;\n+    using LoggerPtr = std::shared_ptr<Logger>;\n+\n+    class LogRegistry {\n+      public:\n+        LogRegistry(LogRegistry const &) = delete;            // copy construct","path":"inc/osvr/Util/LogRegistry.h","position":60,"original_position":60,"commit_id":"bc945d1496ff94f1814f012d5cc5d792bae2e08c","original_commit_id":"bc945d1496ff94f1814f012d5cc5d792bae2e08c","user":{"login":"godbyk","id":195036,"avatar_url":"https://avatars.githubusercontent.com/u/195036?v=3","gravatar_id":"","url":"https://api.github.com/users/godbyk","html_url":"https://github.com/godbyk","followers_url":"https://api.github.com/users/godbyk/followers","following_url":"https://api.github.com/users/godbyk/following{/other_user}","gists_url":"https://api.github.com/users/godbyk/gists{/gist_id}","starred_url":"https://api.github.com/users/godbyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godbyk/subscriptions","organizations_url":"https://api.github.com/users/godbyk/orgs","repos_url":"https://api.github.com/users/godbyk/repos","events_url":"https://api.github.com/users/godbyk/events{/privacy}","received_events_url":"https://api.github.com/users/godbyk/received_events","type":"User","site_admin":false},"body":"Just makes the intention clear.","created_at":"2016-07-22T23:47:50Z","updated_at":"2016-07-22T23:47:50Z","html_url":"https://github.com/OSVR/OSVR-Core/pull/397#discussion_r71960467","pull_request_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397","_links":{"self":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/comments/71960467"},"html":{"href":"https://github.com/OSVR/OSVR-Core/pull/397#discussion_r71960467"},"pull_request":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397"}}},"pull_request":{"url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397","id":63448698,"html_url":"https://github.com/OSVR/OSVR-Core/pull/397","diff_url":"https://github.com/OSVR/OSVR-Core/pull/397.diff","patch_url":"https://github.com/OSVR/OSVR-Core/pull/397.patch","issue_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/397","number":397,"state":"open","locked":false,"title":"Logging system","user":{"login":"godbyk","id":195036,"avatar_url":"https://avatars.githubusercontent.com/u/195036?v=3","gravatar_id":"","url":"https://api.github.com/users/godbyk","html_url":"https://github.com/godbyk","followers_url":"https://api.github.com/users/godbyk/followers","following_url":"https://api.github.com/users/godbyk/following{/other_user}","gists_url":"https://api.github.com/users/godbyk/gists{/gist_id}","starred_url":"https://api.github.com/users/godbyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godbyk/subscriptions","organizations_url":"https://api.github.com/users/godbyk/orgs","repos_url":"https://api.github.com/users/godbyk/repos","events_url":"https://api.github.com/users/godbyk/events{/privacy}","received_events_url":"https://api.github.com/users/godbyk/received_events","type":"User","site_admin":false},"body":"This PR addresses issue #41 by providing a logging system that can be used internally by OSVR libraries and externally by OSVR clients and plugins. It logs both to the console and to a log file.\r\n\r\n## Logging from within OSVR libraries\r\n\r\nInternally, you have full access to the C++ Logger interface:\r\n```c++\r\n#include <osvr/Util/Log.h>\r\n\r\nauto logger = osvr::util::log::make_logger(\"RenderManager\");\r\nlogger->error() << \"Hello, \" << \"world!\"; // stream operator\r\n```\r\n\r\n## Logging from an OSVR client\r\nA more limited interface is provided for clients:\r\n```c++\r\n// C API\r\n#include <osvr/ClientKit/ContextC.h>\r\n\r\n// C++ API\r\n#include <osvr/ClientKit/Context.h>\r\n\r\nint main() {\r\n    // C API\r\n    OSVR_ClientContext ctx = osvrClientInit(\"com.osvr.example.client\", 0);\r\n    osvrClientLog(ctx, OSVR_LOGLEVEL_NOTICE, \"Hello, world!\");\r\n\r\n    // C++ API\r\n    osvr::clientkit::ClientContext context(\"com.osvr.example.client\");\r\n    context.log(OSVR_LOGLEVEL_EMERG, \"Goodbye, cruel world!\");\r\n}\r\n```\r\n\r\n## Logging from an OSVR plugin\r\n\r\nA similar interface is provided for plugins:\r\n\r\n```c++\r\n#include <osvr/PluginKit/PluginKitC.h>\r\n// ... or ...\r\n#include <osvr/PluginKit/PluginKit.h>\r\n\r\nOSVR_PLUGIN(org_osvr_example_plugin)\r\n{\r\n    // C API\r\n    osvrPluginLog(ctx, OSVR_LOGLEVEL_INFO, \"Plugin loaded.\");\r\n\r\n    // C++ PluginKit\r\n    osvr::pluginkit::PluginContext context{ctx};\r\n    context.log(OSVR_LOGLEVEL_TRACE, \"Plugin loaded.\");\r\n\r\n    // ...\r\n\r\n    return OSVR_RETURN_SUCCESS;\r\n}\r\n```\r\n\r\n## Log file locations\r\n\r\nThe log files are stored in platform-sensitive locations:\r\n\r\n  * Windows: `%LocalAppData%\\OSVR\\Logs\\`\r\n  * Linux: `$XDG_CACHE_HOME/osvr/logs` or `$HOME/.cache/osvr/logs`\r\n  * OS X: `$HOME/Library/Logs/OSVR`\r\n\r\n## Future plans\r\n\r\nThese are items on my to do list that aren't in this pull request (primarily because I want to merge before I venture any further away from the master branch).\r\n\r\n- [ ] Allow log files location to be overridden with environment variable or API call.\r\n- [ ] Modify `osvr_server` to allow for various logging parameters to be set (e.g., log file location, disable/enable console output, set log verbosity/severity levels).\r\n- [ ] Evaluate existing uses of the `OSVR_DEV_VERBOSE()` macro and convert them to the new logging system.\r\n- [ ] Add color console output to Windows.\r\n- [ ] Explore adding sinks for game engine IDEs (e.g., Unreal, Unity).\r\n- [ ] Implement and test logging on Android. (An Android sink exists, but I haven't tied it in yet.)","created_at":"2016-03-18T23:19:14Z","updated_at":"2016-07-22T23:47:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"158e3620446e2984891624a75233787534b2c993","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397/commits","review_comments_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397/comments","review_comment_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/397/comments","statuses_url":"https://api.github.com/repos/OSVR/OSVR-Core/statuses/bc945d1496ff94f1814f012d5cc5d792bae2e08c","head":{"label":"OSVR:features/logging","ref":"features/logging","sha":"bc945d1496ff94f1814f012d5cc5d792bae2e08c","user":{"login":"OSVR","id":10343613,"avatar_url":"https://avatars.githubusercontent.com/u/10343613?v=3","gravatar_id":"","url":"https://api.github.com/users/OSVR","html_url":"https://github.com/OSVR","followers_url":"https://api.github.com/users/OSVR/followers","following_url":"https://api.github.com/users/OSVR/following{/other_user}","gists_url":"https://api.github.com/users/OSVR/gists{/gist_id}","starred_url":"https://api.github.com/users/OSVR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSVR/subscriptions","organizations_url":"https://api.github.com/users/OSVR/orgs","repos_url":"https://api.github.com/users/OSVR/repos","events_url":"https://api.github.com/users/OSVR/events{/privacy}","received_events_url":"https://api.github.com/users/OSVR/received_events","type":"Organization","site_admin":false},"repo":{"id":25528375,"name":"OSVR-Core","full_name":"OSVR/OSVR-Core","owner":{"login":"OSVR","id":10343613,"avatar_url":"https://avatars.githubusercontent.com/u/10343613?v=3","gravatar_id":"","url":"https://api.github.com/users/OSVR","html_url":"https://github.com/OSVR","followers_url":"https://api.github.com/users/OSVR/followers","following_url":"https://api.github.com/users/OSVR/following{/other_user}","gists_url":"https://api.github.com/users/OSVR/gists{/gist_id}","starred_url":"https://api.github.com/users/OSVR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSVR/subscriptions","organizations_url":"https://api.github.com/users/OSVR/orgs","repos_url":"https://api.github.com/users/OSVR/repos","events_url":"https://api.github.com/users/OSVR/events{/privacy}","received_events_url":"https://api.github.com/users/OSVR/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSVR/OSVR-Core","description":"The core libraries, applications, and plugins of the OSVR software platform.","fork":false,"url":"https://api.github.com/repos/OSVR/OSVR-Core","forks_url":"https://api.github.com/repos/OSVR/OSVR-Core/forks","keys_url":"https://api.github.com/repos/OSVR/OSVR-Core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSVR/OSVR-Core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSVR/OSVR-Core/teams","hooks_url":"https://api.github.com/repos/OSVR/OSVR-Core/hooks","issue_events_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/events{/number}","events_url":"https://api.github.com/repos/OSVR/OSVR-Core/events","assignees_url":"https://api.github.com/repos/OSVR/OSVR-Core/assignees{/user}","branches_url":"https://api.github.com/repos/OSVR/OSVR-Core/branches{/branch}","tags_url":"https://api.github.com/repos/OSVR/OSVR-Core/tags","blobs_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSVR/OSVR-Core/statuses/{sha}","languages_url":"https://api.github.com/repos/OSVR/OSVR-Core/languages","stargazers_url":"https://api.github.com/repos/OSVR/OSVR-Core/stargazers","contributors_url":"https://api.github.com/repos/OSVR/OSVR-Core/contributors","subscribers_url":"https://api.github.com/repos/OSVR/OSVR-Core/subscribers","subscription_url":"https://api.github.com/repos/OSVR/OSVR-Core/subscription","commits_url":"https://api.github.com/repos/OSVR/OSVR-Core/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSVR/OSVR-Core/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSVR/OSVR-Core/contents/{+path}","compare_url":"https://api.github.com/repos/OSVR/OSVR-Core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSVR/OSVR-Core/merges","archive_url":"https://api.github.com/repos/OSVR/OSVR-Core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSVR/OSVR-Core/downloads","issues_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues{/number}","pulls_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls{/number}","milestones_url":"https://api.github.com/repos/OSVR/OSVR-Core/milestones{/number}","notifications_url":"https://api.github.com/repos/OSVR/OSVR-Core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSVR/OSVR-Core/labels{/name}","releases_url":"https://api.github.com/repos/OSVR/OSVR-Core/releases{/id}","deployments_url":"https://api.github.com/repos/OSVR/OSVR-Core/deployments","created_at":"2014-10-21T14:56:46Z","updated_at":"2016-07-21T02:20:42Z","pushed_at":"2016-07-22T18:24:27Z","git_url":"git://github.com/OSVR/OSVR-Core.git","ssh_url":"git@github.com:OSVR/OSVR-Core.git","clone_url":"https://github.com/OSVR/OSVR-Core.git","svn_url":"https://github.com/OSVR/OSVR-Core","homepage":"","size":16885,"stargazers_count":177,"watchers_count":177,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":184,"forks":69,"open_issues":184,"watchers":177,"default_branch":"master"}},"base":{"label":"OSVR:master","ref":"master","sha":"879676254734e4081315ee0e69f47171df1e9a9a","user":{"login":"OSVR","id":10343613,"avatar_url":"https://avatars.githubusercontent.com/u/10343613?v=3","gravatar_id":"","url":"https://api.github.com/users/OSVR","html_url":"https://github.com/OSVR","followers_url":"https://api.github.com/users/OSVR/followers","following_url":"https://api.github.com/users/OSVR/following{/other_user}","gists_url":"https://api.github.com/users/OSVR/gists{/gist_id}","starred_url":"https://api.github.com/users/OSVR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSVR/subscriptions","organizations_url":"https://api.github.com/users/OSVR/orgs","repos_url":"https://api.github.com/users/OSVR/repos","events_url":"https://api.github.com/users/OSVR/events{/privacy}","received_events_url":"https://api.github.com/users/OSVR/received_events","type":"Organization","site_admin":false},"repo":{"id":25528375,"name":"OSVR-Core","full_name":"OSVR/OSVR-Core","owner":{"login":"OSVR","id":10343613,"avatar_url":"https://avatars.githubusercontent.com/u/10343613?v=3","gravatar_id":"","url":"https://api.github.com/users/OSVR","html_url":"https://github.com/OSVR","followers_url":"https://api.github.com/users/OSVR/followers","following_url":"https://api.github.com/users/OSVR/following{/other_user}","gists_url":"https://api.github.com/users/OSVR/gists{/gist_id}","starred_url":"https://api.github.com/users/OSVR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSVR/subscriptions","organizations_url":"https://api.github.com/users/OSVR/orgs","repos_url":"https://api.github.com/users/OSVR/repos","events_url":"https://api.github.com/users/OSVR/events{/privacy}","received_events_url":"https://api.github.com/users/OSVR/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSVR/OSVR-Core","description":"The core libraries, applications, and plugins of the OSVR software platform.","fork":false,"url":"https://api.github.com/repos/OSVR/OSVR-Core","forks_url":"https://api.github.com/repos/OSVR/OSVR-Core/forks","keys_url":"https://api.github.com/repos/OSVR/OSVR-Core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSVR/OSVR-Core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSVR/OSVR-Core/teams","hooks_url":"https://api.github.com/repos/OSVR/OSVR-Core/hooks","issue_events_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/events{/number}","events_url":"https://api.github.com/repos/OSVR/OSVR-Core/events","assignees_url":"https://api.github.com/repos/OSVR/OSVR-Core/assignees{/user}","branches_url":"https://api.github.com/repos/OSVR/OSVR-Core/branches{/branch}","tags_url":"https://api.github.com/repos/OSVR/OSVR-Core/tags","blobs_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSVR/OSVR-Core/statuses/{sha}","languages_url":"https://api.github.com/repos/OSVR/OSVR-Core/languages","stargazers_url":"https://api.github.com/repos/OSVR/OSVR-Core/stargazers","contributors_url":"https://api.github.com/repos/OSVR/OSVR-Core/contributors","subscribers_url":"https://api.github.com/repos/OSVR/OSVR-Core/subscribers","subscription_url":"https://api.github.com/repos/OSVR/OSVR-Core/subscription","commits_url":"https://api.github.com/repos/OSVR/OSVR-Core/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSVR/OSVR-Core/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSVR/OSVR-Core/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSVR/OSVR-Core/contents/{+path}","compare_url":"https://api.github.com/repos/OSVR/OSVR-Core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSVR/OSVR-Core/merges","archive_url":"https://api.github.com/repos/OSVR/OSVR-Core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSVR/OSVR-Core/downloads","issues_url":"https://api.github.com/repos/OSVR/OSVR-Core/issues{/number}","pulls_url":"https://api.github.com/repos/OSVR/OSVR-Core/pulls{/number}","milestones_url":"https://api.github.com/repos/OSVR/OSVR-Core/milestones{/number}","notifications_url":"https://api.github.com/repos/OSVR/OSVR-Core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSVR/OSVR-Core/labels{/name}","releases_url":"https://api.github.com/repos/OSVR/OSVR-Core/releases{/id}","deployments_url":"https://api.github.com/repos/OSVR/OSVR-Core/deployments","created_at":"2014-10-21T14:56:46Z","updated_at":"2016-07-21T02:20:42Z","pushed_at":"2016-07-22T18:24:27Z","git_url":"git://github.com/OSVR/OSVR-Core.git","ssh_url":"git@github.com:OSVR/OSVR-Core.git","clone_url":"https://github.com/OSVR/OSVR-Core.git","svn_url":"https://github.com/OSVR/OSVR-Core","homepage":"","size":16885,"stargazers_count":177,"watchers_count":177,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":184,"forks":69,"open_issues":184,"watchers":177,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397"},"html":{"href":"https://github.com/OSVR/OSVR-Core/pull/397"},"issue":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/issues/397"},"comments":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/issues/397/comments"},"review_comments":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397/comments"},"review_comment":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/pulls/397/commits"},"statuses":{"href":"https://api.github.com/repos/OSVR/OSVR-Core/statuses/bc945d1496ff94f1814f012d5cc5d792bae2e08c"}}}}
{"actor":{"display_login":"godbyk"}}