{"action":"created","comment":{"url":"https://api.github.com/repos/Sagacify/logger/pulls/comments/66616495","id":66616495,"diff_hunk":"@@ -0,0 +1,85 @@\n+import bunyan from 'bunyan';\n+import config from './config';\n+import pkg from './package';\n+import Logentries from 'le_node';\n+import BPromise from 'bluebird';\n+import _ from 'lodash';\n+\n+let bunyanStream = {\n+  stream: process.stdout\n+};\n+\n+if (config.logEntries.token) {\n+  bunyanStream = Logentries.bunyanStream({\n+    token: config.logEntries.token,\n+    console: true\n+  });\n+}\n+\n+const mainLogger = bunyan.createLogger({\n+  name: pkg.name,\n+  version: pkg.version,\n+  level: config.logLevel || 'info',\n+  serializers: {\n+    error: bunyan.stdSerializers.err\n+  },\n+  streams: [bunyanStream]\n+});\n+\n+function buildLog (event, data = null, meta = null) {\n+  if (data instanceof Error) {\n+    data = bunyan.stdSerializers.err(data);\n+  }\n+\n+  return { event, data, meta };\n+}\n+\n+const methods = loggerRef => {\n+  const logMethods = {};\n+  ['debug', 'info', 'warn', 'error', 'fatal'].forEach(logLevel => {\n+    logMethods[logLevel] = (event, data, meta) => {\n+      loggerRef[logLevel](buildLog(event, data, meta));\n+    };\n+  });\n+\n+  const logify = (func, event) => (...args) => {\n+    event = _.snakeCase(event).toUpperCase();\n+    let meta = args;\n+    if (args.length === 1 && _.isObject(args[0])) {\n+      meta = args[0];\n+    }\n+    return new BPromise((resolve, reject) => {\n+      loggerRef.debug(event, null, meta);\n+      func.apply(this, args)\n+        .then(result => {\n+          loggerRef.debug(`${event}_SUCCESS`, result, meta);\n+          resolve(result);\n+        })\n+        .catch(err => {\n+          loggerRef.error(`${event}_FAIL`, err, meta);\n+          reject(err);\n+        });\n+    });\n+  };\n+\n+  const logifyAll = (obj, promisified = false) => {\n+    if (promisified === true) {\n+      promisified = 'Async';\n+    }\n+    for (let key in obj) {\n+      if (_.endsWith(key, promisified)) {\n+        obj[key] = logify(obj[key].bind(obj), _.trim(key, promisified));\n+      }\n+    }\n+    return obj;\n+  };\n+\n+  return _.assign(logMethods, { logify, logifyAll });\n+};\n+\n+export const create = info => {\n+  var loggerRef = mainLogger.child(info);","path":"src/index.js","position":81,"original_position":81,"commit_id":"fb66d0fe4fbd6b89d7c7ec79ad62cbe7b29f9f2c","original_commit_id":"fb66d0fe4fbd6b89d7c7ec79ad62cbe7b29f9f2c","user":{"login":"SagaStalin","id":18303362,"avatar_url":"https://avatars.githubusercontent.com/u/18303362?v=3","gravatar_id":"","url":"https://api.github.com/users/SagaStalin","html_url":"https://github.com/SagaStalin","followers_url":"https://api.github.com/users/SagaStalin/followers","following_url":"https://api.github.com/users/SagaStalin/following{/other_user}","gists_url":"https://api.github.com/users/SagaStalin/gists{/gist_id}","starred_url":"https://api.github.com/users/SagaStalin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SagaStalin/subscriptions","organizations_url":"https://api.github.com/users/SagaStalin/orgs","repos_url":"https://api.github.com/users/SagaStalin/repos","events_url":"https://api.github.com/users/SagaStalin/events{/privacy}","received_events_url":"https://api.github.com/users/SagaStalin/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Replace \"var\" with \"let\" or \"const\" [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.sagacify.com/coding_rules#rule_key=javascript%3AS3504)\n","created_at":"2016-06-10T13:55:21Z","updated_at":"2016-06-10T13:55:21Z","html_url":"https://github.com/Sagacify/logger/pull/2#discussion_r66616495","pull_request_url":"https://api.github.com/repos/Sagacify/logger/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/comments/66616495"},"html":{"href":"https://github.com/Sagacify/logger/pull/2#discussion_r66616495"},"pull_request":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Sagacify/logger/pulls/2","id":73373845,"html_url":"https://github.com/Sagacify/logger/pull/2","diff_url":"https://github.com/Sagacify/logger/pull/2.diff","patch_url":"https://github.com/Sagacify/logger/pull/2.patch","issue_url":"https://api.github.com/repos/Sagacify/logger/issues/2","number":2,"state":"open","locked":false,"title":"feat(logify): Add logify and logifyAll methods","user":{"login":"fbeuvens","id":781909,"avatar_url":"https://avatars.githubusercontent.com/u/781909?v=3","gravatar_id":"","url":"https://api.github.com/users/fbeuvens","html_url":"https://github.com/fbeuvens","followers_url":"https://api.github.com/users/fbeuvens/followers","following_url":"https://api.github.com/users/fbeuvens/following{/other_user}","gists_url":"https://api.github.com/users/fbeuvens/gists{/gist_id}","starred_url":"https://api.github.com/users/fbeuvens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fbeuvens/subscriptions","organizations_url":"https://api.github.com/users/fbeuvens/orgs","repos_url":"https://api.github.com/users/fbeuvens/repos","events_url":"https://api.github.com/users/fbeuvens/events{/privacy}","received_events_url":"https://api.github.com/users/fbeuvens/received_events","type":"User","site_admin":false},"body":"Move to es6","created_at":"2016-06-10T13:31:22Z","updated_at":"2016-06-10T13:55:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42f33d9e79e52b43a94393767334d5f24e764d8c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sagacify/logger/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Sagacify/logger/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Sagacify/logger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sagacify/logger/issues/2/comments","statuses_url":"https://api.github.com/repos/Sagacify/logger/statuses/fb66d0fe4fbd6b89d7c7ec79ad62cbe7b29f9f2c","head":{"label":"Sagacify:feat-logify","ref":"feat-logify","sha":"fb66d0fe4fbd6b89d7c7ec79ad62cbe7b29f9f2c","user":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"repo":{"id":53572975,"name":"logger","full_name":"Sagacify/logger","owner":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sagacify/logger","description":"A basic Logger object that force a logging format, can use logentries","fork":false,"url":"https://api.github.com/repos/Sagacify/logger","forks_url":"https://api.github.com/repos/Sagacify/logger/forks","keys_url":"https://api.github.com/repos/Sagacify/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sagacify/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sagacify/logger/teams","hooks_url":"https://api.github.com/repos/Sagacify/logger/hooks","issue_events_url":"https://api.github.com/repos/Sagacify/logger/issues/events{/number}","events_url":"https://api.github.com/repos/Sagacify/logger/events","assignees_url":"https://api.github.com/repos/Sagacify/logger/assignees{/user}","branches_url":"https://api.github.com/repos/Sagacify/logger/branches{/branch}","tags_url":"https://api.github.com/repos/Sagacify/logger/tags","blobs_url":"https://api.github.com/repos/Sagacify/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sagacify/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sagacify/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sagacify/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sagacify/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/Sagacify/logger/languages","stargazers_url":"https://api.github.com/repos/Sagacify/logger/stargazers","contributors_url":"https://api.github.com/repos/Sagacify/logger/contributors","subscribers_url":"https://api.github.com/repos/Sagacify/logger/subscribers","subscription_url":"https://api.github.com/repos/Sagacify/logger/subscription","commits_url":"https://api.github.com/repos/Sagacify/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sagacify/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sagacify/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sagacify/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sagacify/logger/contents/{+path}","compare_url":"https://api.github.com/repos/Sagacify/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sagacify/logger/merges","archive_url":"https://api.github.com/repos/Sagacify/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sagacify/logger/downloads","issues_url":"https://api.github.com/repos/Sagacify/logger/issues{/number}","pulls_url":"https://api.github.com/repos/Sagacify/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/Sagacify/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/Sagacify/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sagacify/logger/labels{/name}","releases_url":"https://api.github.com/repos/Sagacify/logger/releases{/id}","deployments_url":"https://api.github.com/repos/Sagacify/logger/deployments","created_at":"2016-03-10T09:42:25Z","updated_at":"2016-03-10T14:37:45Z","pushed_at":"2016-06-10T13:53:53Z","git_url":"git://github.com/Sagacify/logger.git","ssh_url":"git@github.com:Sagacify/logger.git","clone_url":"https://github.com/Sagacify/logger.git","svn_url":"https://github.com/Sagacify/logger","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":0,"default_branch":"master"}},"base":{"label":"Sagacify:master","ref":"master","sha":"6872d58011d04b89cbb348dedcc8f40eecb095d5","user":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"repo":{"id":53572975,"name":"logger","full_name":"Sagacify/logger","owner":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sagacify/logger","description":"A basic Logger object that force a logging format, can use logentries","fork":false,"url":"https://api.github.com/repos/Sagacify/logger","forks_url":"https://api.github.com/repos/Sagacify/logger/forks","keys_url":"https://api.github.com/repos/Sagacify/logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sagacify/logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sagacify/logger/teams","hooks_url":"https://api.github.com/repos/Sagacify/logger/hooks","issue_events_url":"https://api.github.com/repos/Sagacify/logger/issues/events{/number}","events_url":"https://api.github.com/repos/Sagacify/logger/events","assignees_url":"https://api.github.com/repos/Sagacify/logger/assignees{/user}","branches_url":"https://api.github.com/repos/Sagacify/logger/branches{/branch}","tags_url":"https://api.github.com/repos/Sagacify/logger/tags","blobs_url":"https://api.github.com/repos/Sagacify/logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sagacify/logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sagacify/logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sagacify/logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sagacify/logger/statuses/{sha}","languages_url":"https://api.github.com/repos/Sagacify/logger/languages","stargazers_url":"https://api.github.com/repos/Sagacify/logger/stargazers","contributors_url":"https://api.github.com/repos/Sagacify/logger/contributors","subscribers_url":"https://api.github.com/repos/Sagacify/logger/subscribers","subscription_url":"https://api.github.com/repos/Sagacify/logger/subscription","commits_url":"https://api.github.com/repos/Sagacify/logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sagacify/logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sagacify/logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sagacify/logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sagacify/logger/contents/{+path}","compare_url":"https://api.github.com/repos/Sagacify/logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sagacify/logger/merges","archive_url":"https://api.github.com/repos/Sagacify/logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sagacify/logger/downloads","issues_url":"https://api.github.com/repos/Sagacify/logger/issues{/number}","pulls_url":"https://api.github.com/repos/Sagacify/logger/pulls{/number}","milestones_url":"https://api.github.com/repos/Sagacify/logger/milestones{/number}","notifications_url":"https://api.github.com/repos/Sagacify/logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sagacify/logger/labels{/name}","releases_url":"https://api.github.com/repos/Sagacify/logger/releases{/id}","deployments_url":"https://api.github.com/repos/Sagacify/logger/deployments","created_at":"2016-03-10T09:42:25Z","updated_at":"2016-03-10T14:37:45Z","pushed_at":"2016-06-10T13:53:53Z","git_url":"git://github.com/Sagacify/logger.git","ssh_url":"git@github.com:Sagacify/logger.git","clone_url":"https://github.com/Sagacify/logger.git","svn_url":"https://github.com/Sagacify/logger","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/2"},"html":{"href":"https://github.com/Sagacify/logger/pull/2"},"issue":{"href":"https://api.github.com/repos/Sagacify/logger/issues/2"},"comments":{"href":"https://api.github.com/repos/Sagacify/logger/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sagacify/logger/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Sagacify/logger/statuses/fb66d0fe4fbd6b89d7c7ec79ad62cbe7b29f9f2c"}}}}
{"actor":{"display_login":"SagaStalin"}}