{"action":"created","comment":{"url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/comments/85349915","pull_request_review_id":6071398,"id":85349915,"diff_hunk":"@@ -0,0 +1,121 @@\n+#pragma once\n+#include <iostream>\n+#include <fstream>\n+#include <set>\n+#include <typeinfo>\n+\n+typedef std::ostream & (*manip)(std::ostream &);\n+\n+class SimpleLogger\n+{\n+public:\n+  static SimpleLogger & GetLogger()\n+  {\n+    static SimpleLogger OnlyLogger;\n+    return OnlyLogger;\n+  }\n+\n+  ~SimpleLogger ()\n+  {\n+   Close();\n+  }\n+\n+  void SetOutput(std::ostream * os) { m_os = os; }\n+  void SetOutput(std::string const & fileName)\n+  {\n+    Close();\n+\n+    m_os = new std::ofstream{fileName};\n+  }\n+\n+  template<typename T>\n+  SimpleLogger & operator << (T const & obj)\n+  {\n+    if(m_loggerOn)\n+      (*m_os) << obj;\n+    return *this;\n+  }\n+\n+  SimpleLogger & operator << (std::ostream & (*pf)(std::ostream &))\n+  {\n+    if(pf == static_cast<manip>(std::endl) && m_loggerOn)\n+      (*m_os) << std::endl;\n+    return *this;\n+  }\n+\n+  SimpleLogger & operator << (std::string const & obj)\n+  {\n+    *m_os << obj;\n+    return *this;\n+  }\n+\n+  template<typename T, template<typename, typename...> class C, typename... Args>\n+  SimpleLogger & operator << (C<T, Args...> const & objs)\n+  {\n+    for (auto const & obj : objs)\n+      (*this) << obj << \"\\n\";\n+    return *this;\n+  }\n+\n+  void On() { m_loggerOn = true; }\n+  void Off() { m_loggerOn = false; }\n+\n+  //переключиться на вывод в консоль\n+  void Checkout()\n+  {\n+    if(m_thisFile == \"\")\n+      return;\n+\n+    m_countJump++;\n+    *m_os << \"*******Jump Number \" << m_countJump << \" in console\" << std::endl;\n+\n+    Close();\n+    m_os = &std::cout;\n+    *m_os << \"*******Jump Number \" << m_countJump << \" from \" << m_thisFile << std::endl;\n+    m_thisFile = \"\";\n+\n+  }\n+  void Checkout(std::string const & fileName)\n+  {\n+    if(fileName == m_thisFile)\n+      return;\n+\n+    m_countJump++;\n+    *m_os << \"*******Jump Number\" << m_countJump << \" in \" << fileName << std::endl;\n+    //если при этом запуске программы еще не было записи в этот файл, то очистить\n+    //и записывать в начало\n+    if(m_files.find(fileName) == m_files.end())\n+    {\n+      Close();\n+\n+      m_os = new std::ofstream(fileName);\n+      m_files.insert(m_thisFile);\n+    }\n+    else\n+    {\n+      Close();\n+\n+      m_os = new std::ofstream(fileName, std::ios_base::app);\n+    }\n+    *m_os << \"*******Jump Number \" << m_countJump << \" from \" << ((m_thisFile == \"\")? \"concole\":m_thisFile) << std::endl;\n+    m_thisFile = fileName;\n+  }\n+private:\n+\n+  void Close()\n+  {\n+    ((std::ofstream *)m_os)->close();","path":"src/gameclasses/logger.hpp","position":107,"original_position":107,"commit_id":"11861684bedab1b9a02cac8e71d60655366625e1","original_commit_id":"11861684bedab1b9a02cac8e71d60655366625e1","user":{"login":"rokuz","id":5437220,"avatar_url":"https://avatars.githubusercontent.com/u/5437220?v=3","gravatar_id":"","url":"https://api.github.com/users/rokuz","html_url":"https://github.com/rokuz","followers_url":"https://api.github.com/users/rokuz/followers","following_url":"https://api.github.com/users/rokuz/following{/other_user}","gists_url":"https://api.github.com/users/rokuz/gists{/gist_id}","starred_url":"https://api.github.com/users/rokuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rokuz/subscriptions","organizations_url":"https://api.github.com/users/rokuz/orgs","repos_url":"https://api.github.com/users/rokuz/repos","events_url":"https://api.github.com/users/rokuz/events{/privacy}","received_events_url":"https://api.github.com/users/rokuz/received_events","type":"User","site_admin":false},"body":"if (m_os == nullptr)\r\n  return;\r\n((std::ofstream *)m_os)->close();\r\ndelete m_os;\r\nm_os = nullptr;","created_at":"2016-10-27T14:34:57Z","updated_at":"2016-10-27T14:34:57Z","html_url":"https://github.com/Corsay/Invaders_Reinc/pull/4#discussion_r85349915","pull_request_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/comments/85349915"},"html":{"href":"https://github.com/Corsay/Invaders_Reinc/pull/4#discussion_r85349915"},"pull_request":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4","id":91035954,"html_url":"https://github.com/Corsay/Invaders_Reinc/pull/4","diff_url":"https://github.com/Corsay/Invaders_Reinc/pull/4.diff","patch_url":"https://github.com/Corsay/Invaders_Reinc/pull/4.patch","issue_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/4","number":4,"state":"open","locked":false,"title":"Hometask 4","user":{"login":"VKoorits","id":20662071,"avatar_url":"https://avatars.githubusercontent.com/u/20662071?v=3","gravatar_id":"","url":"https://api.github.com/users/VKoorits","html_url":"https://github.com/VKoorits","followers_url":"https://api.github.com/users/VKoorits/followers","following_url":"https://api.github.com/users/VKoorits/following{/other_user}","gists_url":"https://api.github.com/users/VKoorits/gists{/gist_id}","starred_url":"https://api.github.com/users/VKoorits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VKoorits/subscriptions","organizations_url":"https://api.github.com/users/VKoorits/orgs","repos_url":"https://api.github.com/users/VKoorits/repos","events_url":"https://api.github.com/users/VKoorits/events{/privacy}","received_events_url":"https://api.github.com/users/VKoorits/received_events","type":"User","site_admin":false},"body":"Создан логгер способный логировать в файлы и на консоль любые объекты и последовательные коллекции объектов, для которых перегружен оператор вывода в поток.","created_at":"2016-10-26T16:03:44Z","updated_at":"2016-10-27T14:34:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a059fbfcb63769f0a7b3ad5ee594ac84908bc5b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4/commits","review_comments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4/comments","review_comment_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/4/comments","statuses_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/statuses/11861684bedab1b9a02cac8e71d60655366625e1","head":{"label":"Corsay:hometask_4","ref":"hometask_4","sha":"11861684bedab1b9a02cac8e71d60655366625e1","user":{"login":"Corsay","id":22316031,"avatar_url":"https://avatars.githubusercontent.com/u/22316031?v=3","gravatar_id":"","url":"https://api.github.com/users/Corsay","html_url":"https://github.com/Corsay","followers_url":"https://api.github.com/users/Corsay/followers","following_url":"https://api.github.com/users/Corsay/following{/other_user}","gists_url":"https://api.github.com/users/Corsay/gists{/gist_id}","starred_url":"https://api.github.com/users/Corsay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Corsay/subscriptions","organizations_url":"https://api.github.com/users/Corsay/orgs","repos_url":"https://api.github.com/users/Corsay/repos","events_url":"https://api.github.com/users/Corsay/events{/privacy}","received_events_url":"https://api.github.com/users/Corsay/received_events","type":"User","site_admin":false},"repo":{"id":69106875,"name":"Invaders_Reinc","full_name":"Corsay/Invaders_Reinc","owner":{"login":"Corsay","id":22316031,"avatar_url":"https://avatars.githubusercontent.com/u/22316031?v=3","gravatar_id":"","url":"https://api.github.com/users/Corsay","html_url":"https://github.com/Corsay","followers_url":"https://api.github.com/users/Corsay/followers","following_url":"https://api.github.com/users/Corsay/following{/other_user}","gists_url":"https://api.github.com/users/Corsay/gists{/gist_id}","starred_url":"https://api.github.com/users/Corsay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Corsay/subscriptions","organizations_url":"https://api.github.com/users/Corsay/orgs","repos_url":"https://api.github.com/users/Corsay/repos","events_url":"https://api.github.com/users/Corsay/events{/privacy}","received_events_url":"https://api.github.com/users/Corsay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Corsay/Invaders_Reinc","description":"Education C++11 project, more information in README.","fork":false,"url":"https://api.github.com/repos/Corsay/Invaders_Reinc","forks_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/forks","keys_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/teams","hooks_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/hooks","issue_events_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/events{/number}","events_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/events","assignees_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/assignees{/user}","branches_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/branches{/branch}","tags_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/tags","blobs_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/refs{/sha}","trees_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/statuses/{sha}","languages_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/languages","stargazers_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/stargazers","contributors_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/contributors","subscribers_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/subscribers","subscription_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/subscription","commits_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/commits{/sha}","git_commits_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/commits{/sha}","comments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/comments{/number}","issue_comment_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/comments{/number}","contents_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/contents/{+path}","compare_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/merges","archive_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/downloads","issues_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues{/number}","pulls_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls{/number}","milestones_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/milestones{/number}","notifications_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/labels{/name}","releases_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/releases{/id}","deployments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/deployments","created_at":"2016-09-24T14:24:56Z","updated_at":"2016-10-16T16:20:22Z","pushed_at":"2016-10-27T14:01:35Z","git_url":"git://github.com/Corsay/Invaders_Reinc.git","ssh_url":"git@github.com:Corsay/Invaders_Reinc.git","clone_url":"https://github.com/Corsay/Invaders_Reinc.git","svn_url":"https://github.com/Corsay/Invaders_Reinc","homepage":"","size":155,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"Corsay:master","ref":"master","sha":"d6a63e2f3f7c7cd287fda64e933d349937678fe6","user":{"login":"Corsay","id":22316031,"avatar_url":"https://avatars.githubusercontent.com/u/22316031?v=3","gravatar_id":"","url":"https://api.github.com/users/Corsay","html_url":"https://github.com/Corsay","followers_url":"https://api.github.com/users/Corsay/followers","following_url":"https://api.github.com/users/Corsay/following{/other_user}","gists_url":"https://api.github.com/users/Corsay/gists{/gist_id}","starred_url":"https://api.github.com/users/Corsay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Corsay/subscriptions","organizations_url":"https://api.github.com/users/Corsay/orgs","repos_url":"https://api.github.com/users/Corsay/repos","events_url":"https://api.github.com/users/Corsay/events{/privacy}","received_events_url":"https://api.github.com/users/Corsay/received_events","type":"User","site_admin":false},"repo":{"id":69106875,"name":"Invaders_Reinc","full_name":"Corsay/Invaders_Reinc","owner":{"login":"Corsay","id":22316031,"avatar_url":"https://avatars.githubusercontent.com/u/22316031?v=3","gravatar_id":"","url":"https://api.github.com/users/Corsay","html_url":"https://github.com/Corsay","followers_url":"https://api.github.com/users/Corsay/followers","following_url":"https://api.github.com/users/Corsay/following{/other_user}","gists_url":"https://api.github.com/users/Corsay/gists{/gist_id}","starred_url":"https://api.github.com/users/Corsay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Corsay/subscriptions","organizations_url":"https://api.github.com/users/Corsay/orgs","repos_url":"https://api.github.com/users/Corsay/repos","events_url":"https://api.github.com/users/Corsay/events{/privacy}","received_events_url":"https://api.github.com/users/Corsay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Corsay/Invaders_Reinc","description":"Education C++11 project, more information in README.","fork":false,"url":"https://api.github.com/repos/Corsay/Invaders_Reinc","forks_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/forks","keys_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/teams","hooks_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/hooks","issue_events_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/events{/number}","events_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/events","assignees_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/assignees{/user}","branches_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/branches{/branch}","tags_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/tags","blobs_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/refs{/sha}","trees_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/statuses/{sha}","languages_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/languages","stargazers_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/stargazers","contributors_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/contributors","subscribers_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/subscribers","subscription_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/subscription","commits_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/commits{/sha}","git_commits_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/git/commits{/sha}","comments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/comments{/number}","issue_comment_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/comments{/number}","contents_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/contents/{+path}","compare_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/merges","archive_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/downloads","issues_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues{/number}","pulls_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls{/number}","milestones_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/milestones{/number}","notifications_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/labels{/name}","releases_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/releases{/id}","deployments_url":"https://api.github.com/repos/Corsay/Invaders_Reinc/deployments","created_at":"2016-09-24T14:24:56Z","updated_at":"2016-10-16T16:20:22Z","pushed_at":"2016-10-27T14:01:35Z","git_url":"git://github.com/Corsay/Invaders_Reinc.git","ssh_url":"git@github.com:Corsay/Invaders_Reinc.git","clone_url":"https://github.com/Corsay/Invaders_Reinc.git","svn_url":"https://github.com/Corsay/Invaders_Reinc","homepage":"","size":155,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4"},"html":{"href":"https://github.com/Corsay/Invaders_Reinc/pull/4"},"issue":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/4"},"comments":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/Corsay/Invaders_Reinc/statuses/11861684bedab1b9a02cac8e71d60655366625e1"}}}}
{"actor":{"display_login":"rokuz"}}