{"action":"created","comment":{"url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/comments/29107938","id":29107938,"diff_hunk":"@@ -0,0 +1,48 @@\n+'use strict';\n+\n+var winston = require('winston');\n+var LogStream = require('logfilestream').LogStream;\n+var config = require('../config');\n+var path = require('path');\n+var production = false;\n+var NODE_ENV = (process.env.NODE_ENV || '').toLowerCase();\n+\n+winston.remove(winston.transports.Console);\n+\n+function init() {\n+    var loggingDir;\n+\n+    switch (NODE_ENV) {\n+    case 'production':\n+        production = true;\n+        loggingDir = path.resolve(__dirname, config.logging.DIR);\n+        console.log('Enabling logging to ', loggingDir);\n+        winston.add(winston.transports.File, {\n+            stream: new LogStream({\n+                logdir: loggingDir,\n+                nameformat: '[brandwatch.]YYYY-MM-DD[.log]',","path":"lib/logging.js","position":null,"original_position":23,"commit_id":"415e04f1a9e84a32ca1428c507374e17023afb84","original_commit_id":"b1d6754b27cb1e1edf28d7a8cb46219189a6c0d8","user":{"login":"larister","id":1177870,"avatar_url":"https://avatars.githubusercontent.com/u/1177870?v=3","gravatar_id":"","url":"https://api.github.com/users/larister","html_url":"https://github.com/larister","followers_url":"https://api.github.com/users/larister/followers","following_url":"https://api.github.com/users/larister/following{/other_user}","gists_url":"https://api.github.com/users/larister/gists{/gist_id}","starred_url":"https://api.github.com/users/larister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larister/subscriptions","organizations_url":"https://api.github.com/users/larister/orgs","repos_url":"https://api.github.com/users/larister/repos","events_url":"https://api.github.com/users/larister/events{/privacy}","received_events_url":"https://api.github.com/users/larister/received_events","type":"User","site_admin":false},"body":"In the production config, the log dir is specified as being within the /go dir, but I think you're right anyway, better safe than sorry.","created_at":"2015-04-26T08:58:46Z","updated_at":"2015-04-26T08:58:46Z","html_url":"https://github.com/bw-allardvanhelbergen/go/pull/62#discussion_r29107938","pull_request_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/comments/29107938"},"html":{"href":"https://github.com/bw-allardvanhelbergen/go/pull/62#discussion_r29107938"},"pull_request":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62","id":34112231,"html_url":"https://github.com/bw-allardvanhelbergen/go/pull/62","diff_url":"https://github.com/bw-allardvanhelbergen/go/pull/62.diff","patch_url":"https://github.com/bw-allardvanhelbergen/go/pull/62.patch","issue_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/62","number":62,"state":"open","locked":false,"title":"Logging","user":{"login":"larister","id":1177870,"avatar_url":"https://avatars.githubusercontent.com/u/1177870?v=3","gravatar_id":"","url":"https://api.github.com/users/larister","html_url":"https://github.com/larister","followers_url":"https://api.github.com/users/larister/followers","following_url":"https://api.github.com/users/larister/following{/other_user}","gists_url":"https://api.github.com/users/larister/gists{/gist_id}","starred_url":"https://api.github.com/users/larister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larister/subscriptions","organizations_url":"https://api.github.com/users/larister/orgs","repos_url":"https://api.github.com/users/larister/repos","events_url":"https://api.github.com/users/larister/events{/privacy}","received_events_url":"https://api.github.com/users/larister/received_events","type":"User","site_admin":false},"body":"Depends on https://github.com/bw-allardvanhelbergen/go/pull/56 and will need a rebase once that's merged.\r\n\r\nThis took a little longer than hoped, but it should all work fine now. I'm not happy with having to use `util.inspects` when logging out the mongo model, as winston should [do that itself](https://github.com/winstonjs/winston#logging-with-metadata). Still, it works; happy to add a TODO if you want.\r\n\r\nMark E also recommended using Bunyan instead; I ran out of time to implement that but feel free to give it a look if you want.","created_at":"2015-04-25T20:07:02Z","updated_at":"2015-04-26T08:58:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c517fe23217d7bc3e040d8a140b95077fa6280ff","assignee":{"login":"larister","id":1177870,"avatar_url":"https://avatars.githubusercontent.com/u/1177870?v=3","gravatar_id":"","url":"https://api.github.com/users/larister","html_url":"https://github.com/larister","followers_url":"https://api.github.com/users/larister/followers","following_url":"https://api.github.com/users/larister/following{/other_user}","gists_url":"https://api.github.com/users/larister/gists{/gist_id}","starred_url":"https://api.github.com/users/larister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larister/subscriptions","organizations_url":"https://api.github.com/users/larister/orgs","repos_url":"https://api.github.com/users/larister/repos","events_url":"https://api.github.com/users/larister/events{/privacy}","received_events_url":"https://api.github.com/users/larister/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62/commits","review_comments_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62/comments","review_comment_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/62/comments","statuses_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/statuses/415e04f1a9e84a32ca1428c507374e17023afb84","head":{"label":"larister:logging","ref":"logging","sha":"415e04f1a9e84a32ca1428c507374e17023afb84","user":{"login":"larister","id":1177870,"avatar_url":"https://avatars.githubusercontent.com/u/1177870?v=3","gravatar_id":"","url":"https://api.github.com/users/larister","html_url":"https://github.com/larister","followers_url":"https://api.github.com/users/larister/followers","following_url":"https://api.github.com/users/larister/following{/other_user}","gists_url":"https://api.github.com/users/larister/gists{/gist_id}","starred_url":"https://api.github.com/users/larister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larister/subscriptions","organizations_url":"https://api.github.com/users/larister/orgs","repos_url":"https://api.github.com/users/larister/repos","events_url":"https://api.github.com/users/larister/events{/privacy}","received_events_url":"https://api.github.com/users/larister/received_events","type":"User","site_admin":false},"repo":{"id":34509819,"name":"go","full_name":"larister/go","owner":{"login":"larister","id":1177870,"avatar_url":"https://avatars.githubusercontent.com/u/1177870?v=3","gravatar_id":"","url":"https://api.github.com/users/larister","html_url":"https://github.com/larister","followers_url":"https://api.github.com/users/larister/followers","following_url":"https://api.github.com/users/larister/following{/other_user}","gists_url":"https://api.github.com/users/larister/gists{/gist_id}","starred_url":"https://api.github.com/users/larister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larister/subscriptions","organizations_url":"https://api.github.com/users/larister/orgs","repos_url":"https://api.github.com/users/larister/repos","events_url":"https://api.github.com/users/larister/events{/privacy}","received_events_url":"https://api.github.com/users/larister/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/larister/go","description":"Go/ - Brandwatch Internal Custom URL Creator","fork":true,"url":"https://api.github.com/repos/larister/go","forks_url":"https://api.github.com/repos/larister/go/forks","keys_url":"https://api.github.com/repos/larister/go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/larister/go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/larister/go/teams","hooks_url":"https://api.github.com/repos/larister/go/hooks","issue_events_url":"https://api.github.com/repos/larister/go/issues/events{/number}","events_url":"https://api.github.com/repos/larister/go/events","assignees_url":"https://api.github.com/repos/larister/go/assignees{/user}","branches_url":"https://api.github.com/repos/larister/go/branches{/branch}","tags_url":"https://api.github.com/repos/larister/go/tags","blobs_url":"https://api.github.com/repos/larister/go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/larister/go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/larister/go/git/refs{/sha}","trees_url":"https://api.github.com/repos/larister/go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/larister/go/statuses/{sha}","languages_url":"https://api.github.com/repos/larister/go/languages","stargazers_url":"https://api.github.com/repos/larister/go/stargazers","contributors_url":"https://api.github.com/repos/larister/go/contributors","subscribers_url":"https://api.github.com/repos/larister/go/subscribers","subscription_url":"https://api.github.com/repos/larister/go/subscription","commits_url":"https://api.github.com/repos/larister/go/commits{/sha}","git_commits_url":"https://api.github.com/repos/larister/go/git/commits{/sha}","comments_url":"https://api.github.com/repos/larister/go/comments{/number}","issue_comment_url":"https://api.github.com/repos/larister/go/issues/comments{/number}","contents_url":"https://api.github.com/repos/larister/go/contents/{+path}","compare_url":"https://api.github.com/repos/larister/go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/larister/go/merges","archive_url":"https://api.github.com/repos/larister/go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/larister/go/downloads","issues_url":"https://api.github.com/repos/larister/go/issues{/number}","pulls_url":"https://api.github.com/repos/larister/go/pulls{/number}","milestones_url":"https://api.github.com/repos/larister/go/milestones{/number}","notifications_url":"https://api.github.com/repos/larister/go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/larister/go/labels{/name}","releases_url":"https://api.github.com/repos/larister/go/releases{/id}","created_at":"2015-04-24T09:25:30Z","updated_at":"2015-04-24T09:25:30Z","pushed_at":"2015-04-26T08:57:36Z","git_url":"git://github.com/larister/go.git","ssh_url":"git@github.com:larister/go.git","clone_url":"https://github.com/larister/go.git","svn_url":"https://github.com/larister/go","homepage":"http://go/","size":678,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"bw-allardvanhelbergen:master","ref":"master","sha":"9c0340c6699a695624a56d6b2648e2aa92372059","user":{"login":"bw-allardvanhelbergen","id":6330375,"avatar_url":"https://avatars.githubusercontent.com/u/6330375?v=3","gravatar_id":"","url":"https://api.github.com/users/bw-allardvanhelbergen","html_url":"https://github.com/bw-allardvanhelbergen","followers_url":"https://api.github.com/users/bw-allardvanhelbergen/followers","following_url":"https://api.github.com/users/bw-allardvanhelbergen/following{/other_user}","gists_url":"https://api.github.com/users/bw-allardvanhelbergen/gists{/gist_id}","starred_url":"https://api.github.com/users/bw-allardvanhelbergen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bw-allardvanhelbergen/subscriptions","organizations_url":"https://api.github.com/users/bw-allardvanhelbergen/orgs","repos_url":"https://api.github.com/users/bw-allardvanhelbergen/repos","events_url":"https://api.github.com/users/bw-allardvanhelbergen/events{/privacy}","received_events_url":"https://api.github.com/users/bw-allardvanhelbergen/received_events","type":"User","site_admin":false},"repo":{"id":26318180,"name":"go","full_name":"bw-allardvanhelbergen/go","owner":{"login":"bw-allardvanhelbergen","id":6330375,"avatar_url":"https://avatars.githubusercontent.com/u/6330375?v=3","gravatar_id":"","url":"https://api.github.com/users/bw-allardvanhelbergen","html_url":"https://github.com/bw-allardvanhelbergen","followers_url":"https://api.github.com/users/bw-allardvanhelbergen/followers","following_url":"https://api.github.com/users/bw-allardvanhelbergen/following{/other_user}","gists_url":"https://api.github.com/users/bw-allardvanhelbergen/gists{/gist_id}","starred_url":"https://api.github.com/users/bw-allardvanhelbergen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bw-allardvanhelbergen/subscriptions","organizations_url":"https://api.github.com/users/bw-allardvanhelbergen/orgs","repos_url":"https://api.github.com/users/bw-allardvanhelbergen/repos","events_url":"https://api.github.com/users/bw-allardvanhelbergen/events{/privacy}","received_events_url":"https://api.github.com/users/bw-allardvanhelbergen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bw-allardvanhelbergen/go","description":"Go/ - Brandwatch Internal Custom URL Creator","fork":false,"url":"https://api.github.com/repos/bw-allardvanhelbergen/go","forks_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/forks","keys_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/teams","hooks_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/hooks","issue_events_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/events{/number}","events_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/events","assignees_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/assignees{/user}","branches_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/branches{/branch}","tags_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/tags","blobs_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/git/refs{/sha}","trees_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/statuses/{sha}","languages_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/languages","stargazers_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/stargazers","contributors_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/contributors","subscribers_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/subscribers","subscription_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/subscription","commits_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/commits{/sha}","git_commits_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/git/commits{/sha}","comments_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/comments{/number}","issue_comment_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/comments{/number}","contents_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/contents/{+path}","compare_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/merges","archive_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/downloads","issues_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues{/number}","pulls_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls{/number}","milestones_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/milestones{/number}","notifications_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/labels{/name}","releases_url":"https://api.github.com/repos/bw-allardvanhelbergen/go/releases{/id}","created_at":"2014-11-07T12:08:27Z","updated_at":"2015-04-25T23:07:10Z","pushed_at":"2015-04-26T08:57:36Z","git_url":"git://github.com/bw-allardvanhelbergen/go.git","ssh_url":"git@github.com:bw-allardvanhelbergen/go.git","clone_url":"https://github.com/bw-allardvanhelbergen/go.git","svn_url":"https://github.com/bw-allardvanhelbergen/go","homepage":"http://go/","size":678,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":23,"forks":3,"open_issues":23,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62"},"html":{"href":"https://github.com/bw-allardvanhelbergen/go/pull/62"},"issue":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/62"},"comments":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/bw-allardvanhelbergen/go/statuses/415e04f1a9e84a32ca1428c507374e17023afb84"}}}}