{"action":"created","comment":{"url":"https://api.github.com/repos/azer/logger/pulls/comments/50456298","id":50456298,"diff_hunk":"@@ -22,35 +33,70 @@ func Enabled() (map[string]bool, bool) {\n \tkeys := strings.Split(val, \",\")\n \n \tfor _, key := range keys {\n-\t\tall[key] = true\n+\t\t// Trim in case people pass space-gapped names.\n+\t\tall[strings.TrimSpace(key)] = true\n \t}\n \n \treturn all, false\n }\n \n+// IsEnabled - Returns whether a given logger is present and enabled.\n func IsEnabled(name string) bool {\n \tif allEnabled {\n \t\treturn true\n \t}\n \n-\t_, ok := enabled[name]\n-\treturn ok\n+\tvalue, ok := enabled[name]\n+\tif !ok {\n+\t\treturn false\n+\t}\n+\treturn value\n }\n \n-func Verbosity() int {\n-\tlevel := os.Getenv(\"LOG_LEVEL\")\n+// SetEnabled - Enable or Disable loggers by name.\n+func SetEnabled(name string, state bool) {\n+\tenabled[name] = state\n+}\n \n-\tif strings.ToUpper(level) == \"TIMER\" {\n-\t\treturn 2\n-\t}\n+// SetAllEnabled - Enable or Disable *all* loggers.\n+// NB: This does not change the status of individual loggers, only whether *all*\n+// loggers should be allowed print. In other words, setting this to 'false' does\n+// not disable loggers that are permitted to print, only those that are not.\n+func SetAllEnabled(state bool) {\n+\tallEnabled = state\n+}\n \n-\tif strings.ToUpper(level) == \"ERROR\" {\n+// Populates default value of 'verbosity' variable from Envvar.\n+func initVerbosity() int {\n+\tswitch strings.ToUpper(os.Getenv(\"LOG_LEVEL\")) {\n+\tcase \"ERROR\":\n \t\treturn 3\n+\tcase \"TIMER\":\n+\t\treturn 2\n+\tdefault:\n+\t\treturn 1\n \t}\n+}\n \n-\treturn 1\n+// Verbosity - Get the value of the LOG_LEVEL environment variable, converted to an integer.\n+// Default/Invalid value is 1. If \"TIMER\", this is 2. If \"ERROR\", this is 3.\n+func Verbosity() int {","path":"settings.go","position":92,"original_position":92,"commit_id":"15aba097c02b244632a7abecf2d8138f4e5b48ed","original_commit_id":"15aba097c02b244632a7abecf2d8138f4e5b48ed","user":{"login":"azer","id":13072,"avatar_url":"https://avatars.githubusercontent.com/u/13072?v=3","gravatar_id":"","url":"https://api.github.com/users/azer","html_url":"https://github.com/azer","followers_url":"https://api.github.com/users/azer/followers","following_url":"https://api.github.com/users/azer/following{/other_user}","gists_url":"https://api.github.com/users/azer/gists{/gist_id}","starred_url":"https://api.github.com/users/azer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azer/subscriptions","organizations_url":"https://api.github.com/users/azer/orgs","repos_url":"https://api.github.com/users/azer/repos","events_url":"https://api.github.com/users/azer/events{/privacy}","received_events_url":"https://api.github.com/users/azer/received_events","type":"User","site_admin":false},"body":"I think we can remove this, too, by just making `verbosity` variable capital case (public)","created_at":"2016-01-21T20:11:12Z","updated_at":"2016-01-21T20:11:12Z","html_url":"https://github.com/azer/logger/pull/4#discussion_r50456298","pull_request_url":"https://api.github.com/repos/azer/logger/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/azer/logger/pulls/comments/50456298"},"html":{"href":"https://github.com/azer/logger/pull/4#discussion_r50456298"},"pull_request":{"href":"https://api.github.com/repos/azer/logger/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/azer/logger/pulls/4","id":56797307,"html_url":"https://github.com/azer/logger/pull/4","diff_url":"https://github.com/azer/logger/pull/4.diff","patch_url":"https://github.com/azer/logger/pull/4.patch","issue_url":"https://api.github.com/repos/azer/logger/issues/4","number":4,"state":"open","locked":false,"title":"Added setters for log enablement, all-log enablement, and log level.","user":{"login":"cathalgarvey","id":1167837,"avatar_url":"https://avatars.githubusercontent.com/u/1167837?v=3","gravatar_id":"","url":"https://api.github.com/users/cathalgarvey","html_url":"https://github.com/cathalgarvey","followers_url":"https://api.github.com/users/cathalgarvey/followers","following_url":"https://api.github.com/users/cathalgarvey/following{/other_user}","gists_url":"https://api.github.com/users/cathalgarvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cathalgarvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathalgarvey/subscriptions","organizations_url":"https://api.github.com/users/cathalgarvey/orgs","repos_url":"https://api.github.com/users/cathalgarvey/repos","events_url":"https://api.github.com/users/cathalgarvey/events{/privacy}","received_events_url":"https://api.github.com/users/cathalgarvey/received_events","type":"User","site_admin":false},"body":"To make this make sense, also had to add code that checks whether\r\nlogs are enabled at call time rather than checking the value of\r\n`IsEnabled` which is set at instantiation time. The value of IsEnabled\r\nis updated whenever an internal method that uses it checks for\r\nenablement.\r\n\r\nAdded a little bit of documentation to existing and new functions.","created_at":"2016-01-21T19:32:25Z","updated_at":"2016-01-21T20:11:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b009ee60023d513149664a537d104b549f48eaa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/azer/logger/pulls/4/commits","review_comments_url":"https://api.github.com/repos/azer/logger/pulls/4/comments","review_comment_url":"https://api.github.com/repos/azer/logger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/azer/logger/issues/4/comments","statuses_url":"https://api.github.com/repos/azer/logger/statuses/15aba097c02b244632a7abecf2d8138f4e5b48ed","head":{"label":"cathalgarvey:master","ref":"master","sha":"15aba097c02b244632a7abecf2d8138f4e5b48ed","user":{"login":"cathalgarvey","id":1167837,"avatar_url":"https://avatars.githubusercontent.com/u/1167837?v=3","gravatar_id":"","url":"https://api.github.com/users/cathalgarvey","html_url":"https://github.com/cathalgarvey","followers_url":"https://api.github.com/users/cathalgarvey/followers","following_url":"https://api.github.com/users/cathalgarvey/following{/other_user}","gists_url":"https://api.github.com/users/cathalgarvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cathalgarvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathalgarvey/subscriptions","organizations_url":"https://api.github.com/users/cathalgarvey/orgs","repos_url":"https://api.github.com/users/cathalgarvey/repos","events_url":"https://api.github.com/users/cathalgarvey/events{/privacy}","received_events_url":"https://api.github.com/users/cathalgarvey/received_events","type":"User","site_admin":false},"repo":{"id":50129573,"name":"logger","full_name":"cathalgarvey/logger","owner":{"login":"cathalgarvey","id":1167837,"avatar_url":"https://avatars.githubusercontent.com/u/1167837?v=3","gravatar_id":"","url":"https://api.github.com/users/cathalgarvey","html_url":"https://github.com/cathalgarvey","followers_url":"https://api.github.com/users/cathalgarvey/followers","following_url":"https://api.github.com/users/cathalgarvey/following{/other_user}","gists_url":"https://api.github.com/users/cathalgarvey/gists{/gist_id}","starred_url":"https://api.github.com/users/cathalgarvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathalgarvey/subscriptions","organizations_url":"https://api.github.com/users/cathalgarvey/orgs","repos_url":"https://api.github.com/users/cathalgarvey/repos","events_url":"https://api.github.com/users/cathalgarvey/events{/privacy}","received_events_url":"https://api.github.com/users/cathalgarvey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cathalgarvey/logger","description":"Minimalistic logging library for Go.","fork":true,"url":"https://api.github.com/repos/cathalgarvey/logger","forks_url":"https://api.github.com/repos/cathalgarvey/logger/forks","keys_url":"https://api.github.com/repos/cathalgarvey/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cathalgarvey/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cathalgarvey/logger/teams","hooks_url":"https://api.github.com/repos/cathalgarvey/logger/hooks","issue_events_url":"https://api.github.com/repos/cathalgarvey/logger/issues/events{/number}","events_url":"https://api.github.com/repos/cathalgarvey/logger/events","assignees_url":"https://api.github.com/repos/cathalgarvey/logger/assignees{/user}","branches_url":"https://api.github.com/repos/cathalgarvey/logger/branches{/branch}","tags_url":"https://api.github.com/repos/cathalgarvey/logger/tags","blobs_url":"https://api.github.com/repos/cathalgarvey/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cathalgarvey/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cathalgarvey/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/cathalgarvey/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cathalgarvey/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/cathalgarvey/logger/languages","stargazers_url":"https://api.github.com/repos/cathalgarvey/logger/stargazers","contributors_url":"https://api.github.com/repos/cathalgarvey/logger/contributors","subscribers_url":"https://api.github.com/repos/cathalgarvey/logger/subscribers","subscription_url":"https://api.github.com/repos/cathalgarvey/logger/subscription","commits_url":"https://api.github.com/repos/cathalgarvey/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/cathalgarvey/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/cathalgarvey/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/cathalgarvey/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/cathalgarvey/logger/contents/{+path}","compare_url":"https://api.github.com/repos/cathalgarvey/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cathalgarvey/logger/merges","archive_url":"https://api.github.com/repos/cathalgarvey/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cathalgarvey/logger/downloads","issues_url":"https://api.github.com/repos/cathalgarvey/logger/issues{/number}","pulls_url":"https://api.github.com/repos/cathalgarvey/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/cathalgarvey/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/cathalgarvey/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cathalgarvey/logger/labels{/name}","releases_url":"https://api.github.com/repos/cathalgarvey/logger/releases{/id}","created_at":"2016-01-21T18:58:48Z","updated_at":"2016-01-21T18:58:48Z","pushed_at":"2016-01-21T19:31:35Z","git_url":"git://github.com/cathalgarvey/logger.git","ssh_url":"git@github.com:cathalgarvey/logger.git","clone_url":"https://github.com/cathalgarvey/logger.git","svn_url":"https://github.com/cathalgarvey/logger","homepage":"http://godoc.org/github.com/azer/logger","size":19,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"azer:master","ref":"master","sha":"d8432ceeeb5f76a99ab0543708bafba60163de6f","user":{"login":"azer","id":13072,"avatar_url":"https://avatars.githubusercontent.com/u/13072?v=3","gravatar_id":"","url":"https://api.github.com/users/azer","html_url":"https://github.com/azer","followers_url":"https://api.github.com/users/azer/followers","following_url":"https://api.github.com/users/azer/following{/other_user}","gists_url":"https://api.github.com/users/azer/gists{/gist_id}","starred_url":"https://api.github.com/users/azer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azer/subscriptions","organizations_url":"https://api.github.com/users/azer/orgs","repos_url":"https://api.github.com/users/azer/repos","events_url":"https://api.github.com/users/azer/events{/privacy}","received_events_url":"https://api.github.com/users/azer/received_events","type":"User","site_admin":false},"repo":{"id":24627405,"name":"logger","full_name":"azer/logger","owner":{"login":"azer","id":13072,"avatar_url":"https://avatars.githubusercontent.com/u/13072?v=3","gravatar_id":"","url":"https://api.github.com/users/azer","html_url":"https://github.com/azer","followers_url":"https://api.github.com/users/azer/followers","following_url":"https://api.github.com/users/azer/following{/other_user}","gists_url":"https://api.github.com/users/azer/gists{/gist_id}","starred_url":"https://api.github.com/users/azer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azer/subscriptions","organizations_url":"https://api.github.com/users/azer/orgs","repos_url":"https://api.github.com/users/azer/repos","events_url":"https://api.github.com/users/azer/events{/privacy}","received_events_url":"https://api.github.com/users/azer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/azer/logger","description":"Minimalistic logging library for Go.","fork":false,"url":"https://api.github.com/repos/azer/logger","forks_url":"https://api.github.com/repos/azer/logger/forks","keys_url":"https://api.github.com/repos/azer/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azer/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azer/logger/teams","hooks_url":"https://api.github.com/repos/azer/logger/hooks","issue_events_url":"https://api.github.com/repos/azer/logger/issues/events{/number}","events_url":"https://api.github.com/repos/azer/logger/events","assignees_url":"https://api.github.com/repos/azer/logger/assignees{/user}","branches_url":"https://api.github.com/repos/azer/logger/branches{/branch}","tags_url":"https://api.github.com/repos/azer/logger/tags","blobs_url":"https://api.github.com/repos/azer/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azer/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azer/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/azer/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azer/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/azer/logger/languages","stargazers_url":"https://api.github.com/repos/azer/logger/stargazers","contributors_url":"https://api.github.com/repos/azer/logger/contributors","subscribers_url":"https://api.github.com/repos/azer/logger/subscribers","subscription_url":"https://api.github.com/repos/azer/logger/subscription","commits_url":"https://api.github.com/repos/azer/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/azer/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/azer/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/azer/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/azer/logger/contents/{+path}","compare_url":"https://api.github.com/repos/azer/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azer/logger/merges","archive_url":"https://api.github.com/repos/azer/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azer/logger/downloads","issues_url":"https://api.github.com/repos/azer/logger/issues{/number}","pulls_url":"https://api.github.com/repos/azer/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/azer/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/azer/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azer/logger/labels{/name}","releases_url":"https://api.github.com/repos/azer/logger/releases{/id}","created_at":"2014-09-30T06:45:09Z","updated_at":"2016-01-17T00:28:25Z","pushed_at":"2016-01-21T19:32:26Z","git_url":"git://github.com/azer/logger.git","ssh_url":"git@github.com:azer/logger.git","clone_url":"https://github.com/azer/logger.git","svn_url":"https://github.com/azer/logger","homepage":"http://godoc.org/github.com/azer/logger","size":17,"stargazers_count":54,"watchers_count":54,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":54,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/azer/logger/pulls/4"},"html":{"href":"https://github.com/azer/logger/pull/4"},"issue":{"href":"https://api.github.com/repos/azer/logger/issues/4"},"comments":{"href":"https://api.github.com/repos/azer/logger/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/azer/logger/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/azer/logger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/azer/logger/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/azer/logger/statuses/15aba097c02b244632a7abecf2d8138f4e5b48ed"}}}}