{"action":"created","comment":{"url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments/57457748","id":57457748,"diff_hunk":"@@ -443,15 +450,39 @@ def logToScreen(enable=True, handler=None, name=None, stdout=False):\n \n     by default, logToScreen will log to stderr; logging to stdout instead can be done\n     by setting the 'stdout' parameter to True\n+\n+    The `color` parameter enables or disables log colorization using\n+    ANSI terminal escape sequences, according to the following values:\n+\n+    * when `color` is ``auto`` or ``None`` (default), then try to\n+      auto-detect whether the output stream is connected to a terminal;\n+    * when `color` is ``True`` or the string ``'yes'``, then turn on\n+      log colorization unconditionally,\n+    * any other value turns off log colorization unconditionally.\n     \"\"\"\n     handleropts = {'stdout': stdout}\n \n+    use_color_formatter = False  # default\n+    if HAVE_COLOREDLOGS_MODULE:\n+        if color is None or color == 'auto':\n+            # auto-detect\n+            if humanfriendly.terminal.terminal_supports_colors(sys.stdout if stdout else sys.stderr):","path":"lib/vsc/utils/fancylogger.py","position":43,"original_position":43,"commit_id":"847d054e51c0ea865265b760a04679c03789b6e5","original_commit_id":"847d054e51c0ea865265b760a04679c03789b6e5","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":"it's just some akward code in the middle of logToScreen. maybe move the whole color logic to a function that returns the colored formatter or None ?\r\n","created_at":"2016-03-25T16:00:56Z","updated_at":"2016-03-25T16:00:56Z","html_url":"https://github.com/hpcugent/vsc-base/pull/225#discussion_r57457748","pull_request_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225","_links":{"self":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/comments/57457748"},"html":{"href":"https://github.com/hpcugent/vsc-base/pull/225#discussion_r57457748"},"pull_request":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225"}}},"pull_request":{"url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225","id":64164277,"html_url":"https://github.com/hpcugent/vsc-base/pull/225","diff_url":"https://github.com/hpcugent/vsc-base/pull/225.diff","patch_url":"https://github.com/hpcugent/vsc-base/pull/225.patch","issue_url":"https://api.github.com/repos/hpcugent/vsc-base/issues/225","number":225,"state":"open","locked":false,"title":"Add support for colorization of log messages sent to the screen.","user":{"login":"riccardomurri","id":447228,"avatar_url":"https://avatars.githubusercontent.com/u/447228?v=3","gravatar_id":"","url":"https://api.github.com/users/riccardomurri","html_url":"https://github.com/riccardomurri","followers_url":"https://api.github.com/users/riccardomurri/followers","following_url":"https://api.github.com/users/riccardomurri/following{/other_user}","gists_url":"https://api.github.com/users/riccardomurri/gists{/gist_id}","starred_url":"https://api.github.com/users/riccardomurri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riccardomurri/subscriptions","organizations_url":"https://api.github.com/users/riccardomurri/orgs","repos_url":"https://api.github.com/users/riccardomurri/repos","events_url":"https://api.github.com/users/riccardomurri/events{/privacy}","received_events_url":"https://api.github.com/users/riccardomurri/received_events","type":"User","site_admin":false},"body":"The support depends on the external modules `coloredlogs` and\r\n`humanfriendly`; if they are not available, logs will not be colorized\r\nno matter what.\r\n\r\nAn additional option to `fancylogger.logToScreen()` allows turning log\r\ncolorization depending on terminal capabilities, or on/off unconditionally.\r\n\r\n**Note that this makes EasyBuild logs colored by default!**","created_at":"2016-03-25T13:56:38Z","updated_at":"2016-03-25T16:00:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d2cf8db641b33a3e9d8e20eeb858c26e9375995","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225/commits","review_comments_url":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225/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/225/comments","statuses_url":"https://api.github.com/repos/hpcugent/vsc-base/statuses/847d054e51c0ea865265b760a04679c03789b6e5","head":{"label":"riccardomurri:coloredlogs","ref":"coloredlogs","sha":"847d054e51c0ea865265b760a04679c03789b6e5","user":{"login":"riccardomurri","id":447228,"avatar_url":"https://avatars.githubusercontent.com/u/447228?v=3","gravatar_id":"","url":"https://api.github.com/users/riccardomurri","html_url":"https://github.com/riccardomurri","followers_url":"https://api.github.com/users/riccardomurri/followers","following_url":"https://api.github.com/users/riccardomurri/following{/other_user}","gists_url":"https://api.github.com/users/riccardomurri/gists{/gist_id}","starred_url":"https://api.github.com/users/riccardomurri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riccardomurri/subscriptions","organizations_url":"https://api.github.com/users/riccardomurri/orgs","repos_url":"https://api.github.com/users/riccardomurri/repos","events_url":"https://api.github.com/users/riccardomurri/events{/privacy}","received_events_url":"https://api.github.com/users/riccardomurri/received_events","type":"User","site_admin":false},"repo":{"id":54719926,"name":"vsc-base","full_name":"riccardomurri/vsc-base","owner":{"login":"riccardomurri","id":447228,"avatar_url":"https://avatars.githubusercontent.com/u/447228?v=3","gravatar_id":"","url":"https://api.github.com/users/riccardomurri","html_url":"https://github.com/riccardomurri","followers_url":"https://api.github.com/users/riccardomurri/followers","following_url":"https://api.github.com/users/riccardomurri/following{/other_user}","gists_url":"https://api.github.com/users/riccardomurri/gists{/gist_id}","starred_url":"https://api.github.com/users/riccardomurri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riccardomurri/subscriptions","organizations_url":"https://api.github.com/users/riccardomurri/orgs","repos_url":"https://api.github.com/users/riccardomurri/repos","events_url":"https://api.github.com/users/riccardomurri/events{/privacy}","received_events_url":"https://api.github.com/users/riccardomurri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/riccardomurri/vsc-base","description":"Basic Python libraries used by UGent's HPC group","fork":true,"url":"https://api.github.com/repos/riccardomurri/vsc-base","forks_url":"https://api.github.com/repos/riccardomurri/vsc-base/forks","keys_url":"https://api.github.com/repos/riccardomurri/vsc-base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riccardomurri/vsc-base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riccardomurri/vsc-base/teams","hooks_url":"https://api.github.com/repos/riccardomurri/vsc-base/hooks","issue_events_url":"https://api.github.com/repos/riccardomurri/vsc-base/issues/events{/number}","events_url":"https://api.github.com/repos/riccardomurri/vsc-base/events","assignees_url":"https://api.github.com/repos/riccardomurri/vsc-base/assignees{/user}","branches_url":"https://api.github.com/repos/riccardomurri/vsc-base/branches{/branch}","tags_url":"https://api.github.com/repos/riccardomurri/vsc-base/tags","blobs_url":"https://api.github.com/repos/riccardomurri/vsc-base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riccardomurri/vsc-base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riccardomurri/vsc-base/git/refs{/sha}","trees_url":"https://api.github.com/repos/riccardomurri/vsc-base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riccardomurri/vsc-base/statuses/{sha}","languages_url":"https://api.github.com/repos/riccardomurri/vsc-base/languages","stargazers_url":"https://api.github.com/repos/riccardomurri/vsc-base/stargazers","contributors_url":"https://api.github.com/repos/riccardomurri/vsc-base/contributors","subscribers_url":"https://api.github.com/repos/riccardomurri/vsc-base/subscribers","subscription_url":"https://api.github.com/repos/riccardomurri/vsc-base/subscription","commits_url":"https://api.github.com/repos/riccardomurri/vsc-base/commits{/sha}","git_commits_url":"https://api.github.com/repos/riccardomurri/vsc-base/git/commits{/sha}","comments_url":"https://api.github.com/repos/riccardomurri/vsc-base/comments{/number}","issue_comment_url":"https://api.github.com/repos/riccardomurri/vsc-base/issues/comments{/number}","contents_url":"https://api.github.com/repos/riccardomurri/vsc-base/contents/{+path}","compare_url":"https://api.github.com/repos/riccardomurri/vsc-base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riccardomurri/vsc-base/merges","archive_url":"https://api.github.com/repos/riccardomurri/vsc-base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riccardomurri/vsc-base/downloads","issues_url":"https://api.github.com/repos/riccardomurri/vsc-base/issues{/number}","pulls_url":"https://api.github.com/repos/riccardomurri/vsc-base/pulls{/number}","milestones_url":"https://api.github.com/repos/riccardomurri/vsc-base/milestones{/number}","notifications_url":"https://api.github.com/repos/riccardomurri/vsc-base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riccardomurri/vsc-base/labels{/name}","releases_url":"https://api.github.com/repos/riccardomurri/vsc-base/releases{/id}","deployments_url":"https://api.github.com/repos/riccardomurri/vsc-base/deployments","created_at":"2016-03-25T13:22:19Z","updated_at":"2016-03-25T13:22:20Z","pushed_at":"2016-03-25T13:55:52Z","git_url":"git://github.com/riccardomurri/vsc-base.git","ssh_url":"git@github.com:riccardomurri/vsc-base.git","clone_url":"https://github.com/riccardomurri/vsc-base.git","svn_url":"https://github.com/riccardomurri/vsc-base","homepage":null,"size":1201,"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":"0cc76b2d5412fd5eecffeda17b6c966e0be34f74","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}","deployments_url":"https://api.github.com/repos/hpcugent/vsc-base/deployments","created_at":"2013-01-23T01:51:31Z","updated_at":"2016-02-10T11:05:56Z","pushed_at":"2016-03-25T13:56:38Z","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":1313,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":30,"forks":34,"open_issues":30,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225"},"html":{"href":"https://github.com/hpcugent/vsc-base/pull/225"},"issue":{"href":"https://api.github.com/repos/hpcugent/vsc-base/issues/225"},"comments":{"href":"https://api.github.com/repos/hpcugent/vsc-base/issues/225/comments"},"review_comments":{"href":"https://api.github.com/repos/hpcugent/vsc-base/pulls/225/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/225/commits"},"statuses":{"href":"https://api.github.com/repos/hpcugent/vsc-base/statuses/847d054e51c0ea865265b760a04679c03789b6e5"}}}}