{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/comments/31114491","id":31114491,"diff_hunk":"@@ -30,6 +30,32 @@ Code sample:\n       v1-status-callback)\n     context))\n ```\n+\n+\n+## Implementing Your Status Function\n+The puppetlabs.trapperkeeper.services.status.status-core namespace contains\n+some utilities to aid in the implementation of your status functions.  In\n+particular, the `level->int` function defines an ordering for status levels as\n+`:critical < :info < :debug`, and the `level>`, `level<`, `level>=` and `level<=`\n+functions can be used to compare status levels.  These are especially useful in\n+conjunction with the `cond->` macro from clojure.core.  Here's an example of how\n+a status function might be implemented to utilize the `level>=` function:\n+```clj\n+(require '[puppetlabs.trapperkeeper.services.status.status-core :as status-core])\n+\n+(defn my-status\n+  [level]\n+  (let [level>= (partial status-core/level>= level)]\n+    {:is-running true\n+     :status (cond-> {:this-is-critical \"foo\"}\n+               (level>= :info) (assoc :bar \"bar\"\n+                                      :baz \"baz\")\n+               (level>= :debug) (assoc :x \"x\"\n+                                       :y \"y\"\n+                                       :z \"y\"))}))\n+```","path":"documentation/developers.md","position":27,"original_position":27,"commit_id":"24a3652a089ba44837bf50e187f3495678499d6a","original_commit_id":"24a3652a089ba44837bf50e187f3495678499d6a","user":{"login":"cprice404","id":1341071,"avatar_url":"https://avatars.githubusercontent.com/u/1341071?v=3","gravatar_id":"","url":"https://api.github.com/users/cprice404","html_url":"https://github.com/cprice404","followers_url":"https://api.github.com/users/cprice404/followers","following_url":"https://api.github.com/users/cprice404/following{/other_user}","gists_url":"https://api.github.com/users/cprice404/gists{/gist_id}","starred_url":"https://api.github.com/users/cprice404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprice404/subscriptions","organizations_url":"https://api.github.com/users/cprice404/orgs","repos_url":"https://api.github.com/users/cprice404/repos","events_url":"https://api.github.com/users/cprice404/events{/privacy}","received_events_url":"https://api.github.com/users/cprice404/received_events","type":"User","site_admin":false},"body":"Do you think maybe it'd be worth adding another example here that shows how to do it the \"manual\" way if you opt out of the utility comparator fns?  e.g.:\r\n\r\n```clj\r\n(defn my-status\r\n   [level]\r\n   (let [level>= (partial status-core/compare-level >= level)]\r\n      (cond-> {...}\r\n          ...\r\n       )))\r\n```","created_at":"2015-05-27T08:59:09Z","updated_at":"2015-05-27T08:59:09Z","html_url":"https://github.com/puppetlabs/trapperkeeper-status/pull/17#discussion_r31114491","pull_request_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/comments/31114491"},"html":{"href":"https://github.com/puppetlabs/trapperkeeper-status/pull/17#discussion_r31114491"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17","id":36053800,"html_url":"https://github.com/puppetlabs/trapperkeeper-status/pull/17","diff_url":"https://github.com/puppetlabs/trapperkeeper-status/pull/17.diff","patch_url":"https://github.com/puppetlabs/trapperkeeper-status/pull/17.patch","issue_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/17","number":17,"state":"open","locked":false,"title":"(TK-217) Add status level comparison functions","user":{"login":"KevinCorcoran","id":2945462,"avatar_url":"https://avatars.githubusercontent.com/u/2945462?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinCorcoran","html_url":"https://github.com/KevinCorcoran","followers_url":"https://api.github.com/users/KevinCorcoran/followers","following_url":"https://api.github.com/users/KevinCorcoran/following{/other_user}","gists_url":"https://api.github.com/users/KevinCorcoran/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinCorcoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinCorcoran/subscriptions","organizations_url":"https://api.github.com/users/KevinCorcoran/orgs","repos_url":"https://api.github.com/users/KevinCorcoran/repos","events_url":"https://api.github.com/users/KevinCorcoran/events{/privacy}","received_events_url":"https://api.github.com/users/KevinCorcoran/received_events","type":"User","site_admin":false},"body":"Define numeric values for status levels.\r\n\r\nAdd a level>= function to aid in the implementation of status functions\r\nwhich return additive information across status levels.","created_at":"2015-05-22T17:50:13Z","updated_at":"2015-05-27T08:59:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3ab77945f0eb8f101b0b6e7e93e2d9fbb64a1c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/17/comments","statuses_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/statuses/24a3652a089ba44837bf50e187f3495678499d6a","head":{"label":"KevinCorcoran:TK-217","ref":"TK-217","sha":"24a3652a089ba44837bf50e187f3495678499d6a","user":{"login":"KevinCorcoran","id":2945462,"avatar_url":"https://avatars.githubusercontent.com/u/2945462?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinCorcoran","html_url":"https://github.com/KevinCorcoran","followers_url":"https://api.github.com/users/KevinCorcoran/followers","following_url":"https://api.github.com/users/KevinCorcoran/following{/other_user}","gists_url":"https://api.github.com/users/KevinCorcoran/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinCorcoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinCorcoran/subscriptions","organizations_url":"https://api.github.com/users/KevinCorcoran/orgs","repos_url":"https://api.github.com/users/KevinCorcoran/repos","events_url":"https://api.github.com/users/KevinCorcoran/events{/privacy}","received_events_url":"https://api.github.com/users/KevinCorcoran/received_events","type":"User","site_admin":false},"repo":{"id":35688433,"name":"trapperkeeper-status","full_name":"KevinCorcoran/trapperkeeper-status","owner":{"login":"KevinCorcoran","id":2945462,"avatar_url":"https://avatars.githubusercontent.com/u/2945462?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinCorcoran","html_url":"https://github.com/KevinCorcoran","followers_url":"https://api.github.com/users/KevinCorcoran/followers","following_url":"https://api.github.com/users/KevinCorcoran/following{/other_user}","gists_url":"https://api.github.com/users/KevinCorcoran/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinCorcoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinCorcoran/subscriptions","organizations_url":"https://api.github.com/users/KevinCorcoran/orgs","repos_url":"https://api.github.com/users/KevinCorcoran/repos","events_url":"https://api.github.com/users/KevinCorcoran/events{/privacy}","received_events_url":"https://api.github.com/users/KevinCorcoran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KevinCorcoran/trapperkeeper-status","description":"Trapperkeeper Status Service","fork":true,"url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status","forks_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/forks","keys_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/teams","hooks_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/hooks","issue_events_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/issues/events{/number}","events_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/events","assignees_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/assignees{/user}","branches_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/branches{/branch}","tags_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/tags","blobs_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/git/refs{/sha}","trees_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/statuses/{sha}","languages_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/languages","stargazers_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/stargazers","contributors_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/contributors","subscribers_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/subscribers","subscription_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/subscription","commits_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/commits{/sha}","git_commits_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/git/commits{/sha}","comments_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/comments{/number}","issue_comment_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/issues/comments{/number}","contents_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/contents/{+path}","compare_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/merges","archive_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/downloads","issues_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/issues{/number}","pulls_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/pulls{/number}","milestones_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/milestones{/number}","notifications_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/labels{/name}","releases_url":"https://api.github.com/repos/KevinCorcoran/trapperkeeper-status/releases{/id}","created_at":"2015-05-15T17:54:34Z","updated_at":"2015-05-15T17:54:34Z","pushed_at":"2015-05-26T19:21:24Z","git_url":"git://github.com/KevinCorcoran/trapperkeeper-status.git","ssh_url":"git@github.com:KevinCorcoran/trapperkeeper-status.git","clone_url":"https://github.com/KevinCorcoran/trapperkeeper-status.git","svn_url":"https://github.com/KevinCorcoran/trapperkeeper-status","homepage":null,"size":167,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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":"puppetlabs:master","ref":"master","sha":"4cb5ef3cae0cbb36dacf441b529b93ee2757f10a","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":33000992,"name":"trapperkeeper-status","full_name":"puppetlabs/trapperkeeper-status","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/trapperkeeper-status","description":"Trapperkeeper Status Service","fork":false,"url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status","forks_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/forks","keys_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/teams","hooks_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/events","assignees_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/tags","blobs_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/subscription","commits_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/merges","archive_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/downloads","issues_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/releases{/id}","created_at":"2015-03-27T17:54:03Z","updated_at":"2015-05-08T20:57:04Z","pushed_at":"2015-05-26T19:21:24Z","git_url":"git://github.com/puppetlabs/trapperkeeper-status.git","ssh_url":"git@github.com:puppetlabs/trapperkeeper-status.git","clone_url":"https://github.com/puppetlabs/trapperkeeper-status.git","svn_url":"https://github.com/puppetlabs/trapperkeeper-status","homepage":null,"size":522,"stargazers_count":1,"watchers_count":1,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17"},"html":{"href":"https://github.com/puppetlabs/trapperkeeper-status/pull/17"},"issue":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/17"},"comments":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/trapperkeeper-status/statuses/24a3652a089ba44837bf50e187f3495678499d6a"}}}}