{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/65391640","id":65391640,"diff_hunk":"@@ -0,0 +1,59 @@\n+/**\n+* Copyright 2012-2016, Plotly, Inc.\n+* All rights reserved.\n+*\n+* This source code is licensed under the MIT license found in the\n+* LICENSE file in the root directory of this source tree.\n+*/\n+\n+'use strict';\n+\n+var config = require('../plot_api/plot_config');\n+\n+var loggers = module.exports = {};\n+\n+/**\n+ * ------------------------------------------\n+ * debugging tools\n+ * ------------------------------------------\n+ */\n+\n+/* eslint-disable no-console */\n+loggers.log = function() {\n+    if(config.logging > 1) {\n+        var messages = ['LOG:'];\n+\n+        for(var i = 0; i < arguments.length; i++) {\n+            messages.push(arguments[i]);\n+        }\n+\n+        if(console.trace) {\n+            console.trace.apply(console, messages);\n+        } else {\n+            console.log.apply(console, messages);\n+        }\n+    }\n+};\n+\n+loggers.warn = function() {\n+    if(config.logging > 0) {\n+        var messages = ['WARN:'];\n+\n+        for(var i = 0; i < arguments.length; i++) {\n+            messages.push(arguments[i]);\n+        }\n+\n+        if(console.trace) {\n+            console.trace.apply(console, messages);\n+        } else {\n+            console.log.apply(console, messages);\n+        }\n+    }\n+};\n+\n+loggers.error = function() {\n+    if(config.logging > 0) {","path":"src/lib/loggers.js","position":55,"original_position":55,"commit_id":"f328c337bad0a187d44a0982af0ce4d292026afd","original_commit_id":"f328c337bad0a187d44a0982af0ce4d292026afd","user":{"login":"mdtusz","id":6494463,"avatar_url":"https://avatars.githubusercontent.com/u/6494463?v=3","gravatar_id":"","url":"https://api.github.com/users/mdtusz","html_url":"https://github.com/mdtusz","followers_url":"https://api.github.com/users/mdtusz/followers","following_url":"https://api.github.com/users/mdtusz/following{/other_user}","gists_url":"https://api.github.com/users/mdtusz/gists{/gist_id}","starred_url":"https://api.github.com/users/mdtusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdtusz/subscriptions","organizations_url":"https://api.github.com/users/mdtusz/orgs","repos_url":"https://api.github.com/users/mdtusz/repos","events_url":"https://api.github.com/users/mdtusz/events{/privacy}","received_events_url":"https://api.github.com/users/mdtusz/received_events","type":"User","site_admin":false},"body":"Was mainly because `console.error` marks it red as an error. Should I add it for consistency?","created_at":"2016-06-01T16:07:20Z","updated_at":"2016-06-01T16:07:20Z","html_url":"https://github.com/plotly/plotly.js/pull/590#discussion_r65391640","pull_request_url":"https://api.github.com/repos/plotly/plotly.js/pulls/590","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/65391640"},"html":{"href":"https://github.com/plotly/plotly.js/pull/590#discussion_r65391640"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/590"}}},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/590","id":72069824,"html_url":"https://github.com/plotly/plotly.js/pull/590","diff_url":"https://github.com/plotly/plotly.js/pull/590.diff","patch_url":"https://github.com/plotly/plotly.js/pull/590.patch","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/590","number":590,"state":"open","locked":false,"title":"Log levels","user":{"login":"mdtusz","id":6494463,"avatar_url":"https://avatars.githubusercontent.com/u/6494463?v=3","gravatar_id":"","url":"https://api.github.com/users/mdtusz","html_url":"https://github.com/mdtusz","followers_url":"https://api.github.com/users/mdtusz/followers","following_url":"https://api.github.com/users/mdtusz/following{/other_user}","gists_url":"https://api.github.com/users/mdtusz/gists{/gist_id}","starred_url":"https://api.github.com/users/mdtusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdtusz/subscriptions","organizations_url":"https://api.github.com/users/mdtusz/orgs","repos_url":"https://api.github.com/users/mdtusz/repos","events_url":"https://api.github.com/users/mdtusz/events{/privacy}","received_events_url":"https://api.github.com/users/mdtusz/received_events","type":"User","site_admin":false},"body":"Resolves #565.\r\n\r\nIn brief:\r\n* remove `Lib.markTime` calls - these can be done using `console.time` and `console.timeEnd` while developing, then should be removed before committing/pushing\r\n* Add `Lib.log`, `Lib.warn`, and `Lib.error` which can be toggled by setting the `logging` config value\r\n\r\n| Logging level | Result |\r\n|--------------------|---------|\r\n| `0 || false` | Nothing will be output |\r\n| `1` | Only warnings and errors will be output |\r\n| `2` | Warnings, errors, and log messages will be output |\r\n\r\nThere is a downside: the line number when logged shows up as from the `lib/index.js` file. I have somewhat \"fixed\" this by having stack traces printed with logs, but it is not ideal (in my mind) and the methods for circumventing this aren't very robust and don't work with `strict mode` (using `arguments.caller.callee` or overwriting `Error.prepareStackTrace`). \r\n\r\nI think any downsides (i.e. having to click to see the stacktrace on a log message) is worth the benefits of keeping the library quiet in a production setting. ","created_at":"2016-05-31T19:13:13Z","updated_at":"2016-06-01T16:07:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"957925da3b4a547bf6c0c0e5a7313e7b8a350a74","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/plotly/plotly.js/pulls/590/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.js/pulls/590/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/590/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/f328c337bad0a187d44a0982af0ce4d292026afd","head":{"label":"plotly:log-levels","ref":"log-levels","sha":"f328c337bad0a187d44a0982af0ce4d292026afd","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-06-01T15:17:50Z","pushed_at":"2016-06-01T16:01:16Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":115428,"stargazers_count":4733,"watchers_count":4733,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":386,"mirror_url":null,"open_issues_count":145,"forks":386,"open_issues":145,"watchers":4733,"default_branch":"master"}},"base":{"label":"plotly:master","ref":"master","sha":"0f110e1f0e11ef5eb3de70dd06425a500ffc8aee","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-06-01T15:17:50Z","pushed_at":"2016-06-01T16:01:16Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":115428,"stargazers_count":4733,"watchers_count":4733,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":386,"mirror_url":null,"open_issues_count":145,"forks":386,"open_issues":145,"watchers":4733,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/590"},"html":{"href":"https://github.com/plotly/plotly.js/pull/590"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/590"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/590/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/590/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/590/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.js/statuses/f328c337bad0a187d44a0982af0ce4d292026afd"}}}}
{"actor":{"display_login":"mdtusz"}}