{"action":"created","comment":{"url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments/26574486","id":26574486,"diff_hunk":"@@ -0,0 +1,88 @@\n+##\n+# Copyright 2015-2015 Ghent University\n+#\n+# This file is part of vsc-base,\n+# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),\n+# with support of Ghent University (http://ugent.be/hpc),\n+# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),\n+# the Hercules foundation (http://www.herculesstichting.be/in_English)\n+# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).\n+#\n+# http://github.com/hpcugent/vsc-base\n+#\n+# vsc-base is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU Library General Public License as\n+# published by the Free Software Foundation, either version 2 of\n+# the License, or (at your option) any later version.\n+#\n+# vsc-base is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+# GNU Library General Public License for more details.\n+#\n+# You should have received a copy of the GNU Library General Public License\n+# along with vsc-base. If not, see <http://www.gnu.org/licenses/>.\n+##\n+\"\"\"\n+Module providing custom exceptions.\n+\n+@author: Kenneth Hoste (Ghent University)\n+@author: Riccardo Murri (University of Zurich)\n+\"\"\"\n+import inspect\n+import logging\n+from vsc.utils import fancylogger\n+\n+\n+def get_callers_logger():\n+    \"\"\"\n+    Get logger defined in caller's environment\n+    @return: logger instance (or None if none was found)\n+    \"\"\"\n+    logger_cls = logging.getLoggerClass()\n+    frame = inspect.currentframe()\n+    logger = None\n+\n+    # frame may be None, see https://docs.python.org/2/library/inspect.html#inspect.currentframe\n+    if frame is not None:\n+        try:\n+            # consider calling stack in reverse order, i.e. most inner frame (closest to caller) first\n+            for frameinfo in inspect.getouterframes(frame)[::-1]:\n+                bindings = inspect.getargvalues(frameinfo[0]).locals\n+                for val in bindings.values():\n+                    if isinstance(val, logger_cls):\n+                        logger = val\n+                        break\n+        finally:\n+            # make very sure that reference to frame object is removed, to avoid reference cycles\n+            # see https://docs.python.org/2/library/inspect.html#the-interpreter-stack\n+            del frame\n+\n+    return logger\n+\n+\n+class LoggedException(Exception):\n+    \"\"\"Exception that logs it's message when it is created.\"\"\"\n+\n+    # logger module to use (must provide getLogger() function)\n+    LOGGER_MODULE = fancylogger\n+    # logging method to use\n+    # takes a logger instance and an argument of type string, i.e. the log message\n+    # note: 'self' (LoggedException instance) is passed as 1st argument, which is typically just ignored\n+    LOGGING_METHOD = lambda _, logger, msg: logger.error(msg)\n+\n+    def __init__(self, msg, logger=None):","path":"lib/vsc/utils/exceptions.py","position":74,"original_position":74,"commit_id":"d94aa701279ba357da32f98f1c12c78fcc22cb53","original_commit_id":"d94aa701279ba357da32f98f1c12c78fcc22cb53","user":{"login":"stdweird","id":1517606,"avatar_url":"https://avatars.githubusercontent.com/u/1517606?v=3","gravatar_id":"","url":"https://api.github.com/users/stdweird","html_url":"https://github.com/stdweird","followers_url":"https://api.github.com/users/stdweird/followers","following_url":"https://api.github.com/users/stdweird/following{/other_user}","gists_url":"https://api.github.com/users/stdweird/gists{/gist_id}","starred_url":"https://api.github.com/users/stdweird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stdweird/subscriptions","organizations_url":"https://api.github.com/users/stdweird/orgs","repos_url":"https://api.github.com/users/stdweird/repos","events_url":"https://api.github.com/users/stdweird/events{/privacy}","received_events_url":"https://api.github.com/users/stdweird/received_events","type":"User","site_admin":false},"body":"support `*args`","created_at":"2015-03-17T14:04:30Z","updated_at":"2015-03-17T14:04:30Z","html_url":"https://github.com/hpcugent/vsc-base/pull/160#discussion_r26574486","pull_request_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160","_links":{"self":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments/26574486"},"html":{"href":"https://github.com/hpcugent/vsc-base/pull/160#discussion_r26574486"},"pull_request":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160"}}},"pull_request":{"url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160","id":30947895,"html_url":"https://github.com/hpcugent/vsc-base/pull/160","diff_url":"https://github.com/hpcugent/vsc-base/pull/160.diff","patch_url":"https://github.com/hpcugent/vsc-base/pull/160.patch","issue_url":"https://api.github.com/repos/hpcugent/vsc-base/issues/160","number":160,"state":"open","locked":false,"title":"implement LoggedException in vsc.utils.exceptions module","user":{"login":"boegel","id":620876,"avatar_url":"https://avatars.githubusercontent.com/u/620876?v=3","gravatar_id":"","url":"https://api.github.com/users/boegel","html_url":"https://github.com/boegel","followers_url":"https://api.github.com/users/boegel/followers","following_url":"https://api.github.com/users/boegel/following{/other_user}","gists_url":"https://api.github.com/users/boegel/gists{/gist_id}","starred_url":"https://api.github.com/users/boegel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boegel/subscriptions","organizations_url":"https://api.github.com/users/boegel/orgs","repos_url":"https://api.github.com/users/boegel/repos","events_url":"https://api.github.com/users/boegel/events{/privacy}","received_events_url":"https://api.github.com/users/boegel/received_events","type":"User","site_admin":false},"body":"implement idea for self-logging exception mentioned by @riccardomurri in https://github.com/hpcugent/easybuild-framework/pull/1183","created_at":"2015-03-11T14:29:39Z","updated_at":"2015-03-17T14:04:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14f06156b8e2d75fe04785c05d0cfa451cfe183a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160/commits","review_comments_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160/comments","review_comment_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hpcugent/vsc-base/issues/160/comments","statuses_url":"https://api.github.com/repos/hpcugent/vsc-base/statuses/d94aa701279ba357da32f98f1c12c78fcc22cb53","head":{"label":"boegel:loggedexception","ref":"loggedexception","sha":"d94aa701279ba357da32f98f1c12c78fcc22cb53","user":{"login":"boegel","id":620876,"avatar_url":"https://avatars.githubusercontent.com/u/620876?v=3","gravatar_id":"","url":"https://api.github.com/users/boegel","html_url":"https://github.com/boegel","followers_url":"https://api.github.com/users/boegel/followers","following_url":"https://api.github.com/users/boegel/following{/other_user}","gists_url":"https://api.github.com/users/boegel/gists{/gist_id}","starred_url":"https://api.github.com/users/boegel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boegel/subscriptions","organizations_url":"https://api.github.com/users/boegel/orgs","repos_url":"https://api.github.com/users/boegel/repos","events_url":"https://api.github.com/users/boegel/events{/privacy}","received_events_url":"https://api.github.com/users/boegel/received_events","type":"User","site_admin":false},"repo":{"id":8048836,"name":"vsc-base","full_name":"boegel/vsc-base","owner":{"login":"boegel","id":620876,"avatar_url":"https://avatars.githubusercontent.com/u/620876?v=3","gravatar_id":"","url":"https://api.github.com/users/boegel","html_url":"https://github.com/boegel","followers_url":"https://api.github.com/users/boegel/followers","following_url":"https://api.github.com/users/boegel/following{/other_user}","gists_url":"https://api.github.com/users/boegel/gists{/gist_id}","starred_url":"https://api.github.com/users/boegel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boegel/subscriptions","organizations_url":"https://api.github.com/users/boegel/orgs","repos_url":"https://api.github.com/users/boegel/repos","events_url":"https://api.github.com/users/boegel/events{/privacy}","received_events_url":"https://api.github.com/users/boegel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boegel/vsc-base","description":"Basic Python libraries used by UGent's HPC group","fork":true,"url":"https://api.github.com/repos/boegel/vsc-base","forks_url":"https://api.github.com/repos/boegel/vsc-base/forks","keys_url":"https://api.github.com/repos/boegel/vsc-base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boegel/vsc-base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boegel/vsc-base/teams","hooks_url":"https://api.github.com/repos/boegel/vsc-base/hooks","issue_events_url":"https://api.github.com/repos/boegel/vsc-base/issues/events{/number}","events_url":"https://api.github.com/repos/boegel/vsc-base/events","assignees_url":"https://api.github.com/repos/boegel/vsc-base/assignees{/user}","branches_url":"https://api.github.com/repos/boegel/vsc-base/branches{/branch}","tags_url":"https://api.github.com/repos/boegel/vsc-base/tags","blobs_url":"https://api.github.com/repos/boegel/vsc-base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boegel/vsc-base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boegel/vsc-base/git/refs{/sha}","trees_url":"https://api.github.com/repos/boegel/vsc-base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boegel/vsc-base/statuses/{sha}","languages_url":"https://api.github.com/repos/boegel/vsc-base/languages","stargazers_url":"https://api.github.com/repos/boegel/vsc-base/stargazers","contributors_url":"https://api.github.com/repos/boegel/vsc-base/contributors","subscribers_url":"https://api.github.com/repos/boegel/vsc-base/subscribers","subscription_url":"https://api.github.com/repos/boegel/vsc-base/subscription","commits_url":"https://api.github.com/repos/boegel/vsc-base/commits{/sha}","git_commits_url":"https://api.github.com/repos/boegel/vsc-base/git/commits{/sha}","comments_url":"https://api.github.com/repos/boegel/vsc-base/comments{/number}","issue_comment_url":"https://api.github.com/repos/boegel/vsc-base/issues/comments{/number}","contents_url":"https://api.github.com/repos/boegel/vsc-base/contents/{+path}","compare_url":"https://api.github.com/repos/boegel/vsc-base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boegel/vsc-base/merges","archive_url":"https://api.github.com/repos/boegel/vsc-base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boegel/vsc-base/downloads","issues_url":"https://api.github.com/repos/boegel/vsc-base/issues{/number}","pulls_url":"https://api.github.com/repos/boegel/vsc-base/pulls{/number}","milestones_url":"https://api.github.com/repos/boegel/vsc-base/milestones{/number}","notifications_url":"https://api.github.com/repos/boegel/vsc-base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boegel/vsc-base/labels{/name}","releases_url":"https://api.github.com/repos/boegel/vsc-base/releases{/id}","created_at":"2013-02-06T10:07:56Z","updated_at":"2015-03-02T13:06:17Z","pushed_at":"2015-03-15T19:43:00Z","git_url":"git://github.com/boegel/vsc-base.git","ssh_url":"git@github.com:boegel/vsc-base.git","clone_url":"https://github.com/boegel/vsc-base.git","svn_url":"https://github.com/boegel/vsc-base","homepage":null,"size":1516,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hpcugent:master","ref":"master","sha":"2b57b1ce757d510ea816aa73f35307e3b8e2889c","user":{"login":"hpcugent","id":1515263,"avatar_url":"https://avatars.githubusercontent.com/u/1515263?v=3","gravatar_id":"","url":"https://api.github.com/users/hpcugent","html_url":"https://github.com/hpcugent","followers_url":"https://api.github.com/users/hpcugent/followers","following_url":"https://api.github.com/users/hpcugent/following{/other_user}","gists_url":"https://api.github.com/users/hpcugent/gists{/gist_id}","starred_url":"https://api.github.com/users/hpcugent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hpcugent/subscriptions","organizations_url":"https://api.github.com/users/hpcugent/orgs","repos_url":"https://api.github.com/users/hpcugent/repos","events_url":"https://api.github.com/users/hpcugent/events{/privacy}","received_events_url":"https://api.github.com/users/hpcugent/received_events","type":"Organization","site_admin":false},"repo":{"id":7765704,"name":"vsc-base","full_name":"hpcugent/vsc-base","owner":{"login":"hpcugent","id":1515263,"avatar_url":"https://avatars.githubusercontent.com/u/1515263?v=3","gravatar_id":"","url":"https://api.github.com/users/hpcugent","html_url":"https://github.com/hpcugent","followers_url":"https://api.github.com/users/hpcugent/followers","following_url":"https://api.github.com/users/hpcugent/following{/other_user}","gists_url":"https://api.github.com/users/hpcugent/gists{/gist_id}","starred_url":"https://api.github.com/users/hpcugent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hpcugent/subscriptions","organizations_url":"https://api.github.com/users/hpcugent/orgs","repos_url":"https://api.github.com/users/hpcugent/repos","events_url":"https://api.github.com/users/hpcugent/events{/privacy}","received_events_url":"https://api.github.com/users/hpcugent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hpcugent/vsc-base","description":"Basic Python libraries used by UGent's HPC group","fork":false,"url":"https://api.github.com/repos/hpcugent/vsc-base","forks_url":"https://api.github.com/repos/hpcugent/vsc-base/forks","keys_url":"https://api.github.com/repos/hpcugent/vsc-base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hpcugent/vsc-base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hpcugent/vsc-base/teams","hooks_url":"https://api.github.com/repos/hpcugent/vsc-base/hooks","issue_events_url":"https://api.github.com/repos/hpcugent/vsc-base/issues/events{/number}","events_url":"https://api.github.com/repos/hpcugent/vsc-base/events","assignees_url":"https://api.github.com/repos/hpcugent/vsc-base/assignees{/user}","branches_url":"https://api.github.com/repos/hpcugent/vsc-base/branches{/branch}","tags_url":"https://api.github.com/repos/hpcugent/vsc-base/tags","blobs_url":"https://api.github.com/repos/hpcugent/vsc-base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hpcugent/vsc-base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hpcugent/vsc-base/git/refs{/sha}","trees_url":"https://api.github.com/repos/hpcugent/vsc-base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hpcugent/vsc-base/statuses/{sha}","languages_url":"https://api.github.com/repos/hpcugent/vsc-base/languages","stargazers_url":"https://api.github.com/repos/hpcugent/vsc-base/stargazers","contributors_url":"https://api.github.com/repos/hpcugent/vsc-base/contributors","subscribers_url":"https://api.github.com/repos/hpcugent/vsc-base/subscribers","subscription_url":"https://api.github.com/repos/hpcugent/vsc-base/subscription","commits_url":"https://api.github.com/repos/hpcugent/vsc-base/commits{/sha}","git_commits_url":"https://api.github.com/repos/hpcugent/vsc-base/git/commits{/sha}","comments_url":"https://api.github.com/repos/hpcugent/vsc-base/comments{/number}","issue_comment_url":"https://api.github.com/repos/hpcugent/vsc-base/issues/comments{/number}","contents_url":"https://api.github.com/repos/hpcugent/vsc-base/contents/{+path}","compare_url":"https://api.github.com/repos/hpcugent/vsc-base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hpcugent/vsc-base/merges","archive_url":"https://api.github.com/repos/hpcugent/vsc-base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hpcugent/vsc-base/downloads","issues_url":"https://api.github.com/repos/hpcugent/vsc-base/issues{/number}","pulls_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls{/number}","milestones_url":"https://api.github.com/repos/hpcugent/vsc-base/milestones{/number}","notifications_url":"https://api.github.com/repos/hpcugent/vsc-base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hpcugent/vsc-base/labels{/name}","releases_url":"https://api.github.com/repos/hpcugent/vsc-base/releases{/id}","created_at":"2013-01-23T01:51:31Z","updated_at":"2015-03-09T09:46:53Z","pushed_at":"2015-03-09T09:46:53Z","git_url":"git://github.com/hpcugent/vsc-base.git","ssh_url":"git@github.com:hpcugent/vsc-base.git","clone_url":"https://github.com/hpcugent/vsc-base.git","svn_url":"https://github.com/hpcugent/vsc-base","homepage":null,"size":1983,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":15,"forks":15,"open_issues":15,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160"},"html":{"href":"https://github.com/hpcugent/vsc-base/pull/160"},"issue":{"href":"https://api.github.com/repos/hpcugent/vsc-base/issues/160"},"comments":{"href":"https://api.github.com/repos/hpcugent/vsc-base/issues/160/comments"},"review_comments":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160/comments"},"review_comment":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/160/commits"},"statuses":{"href":"https://api.github.com/repos/hpcugent/vsc-base/statuses/d94aa701279ba357da32f98f1c12c78fcc22cb53"}}}}