{"action":"created","comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/55019331","id":55019331,"diff_hunk":"@@ -15,44 +15,47 @@\n \n module CartoDB\n   # Extra can contain `:request` and `:user`\n-  # Deprecated because of that `extra` content limitation. Use `report_exception` instead.\n-  def self.notify_exception(e, extra={})\n-    if Rails.env.development? || Rails.env.test?\n-      backtrace = e.backtrace ? e.backtrace : ['']\n-      ::Logger.new(STDOUT).error \"exception: #{extra.delete(:message)} #{e.message}\\n#{backtrace.join(\"\\n \")}\\nExtra: #{extra}\"\n-    end\n-    Rollbar.report_exception(e, extra.delete(:request), extra.delete(:user))\n-  rescue\n-    # If Rollbar fails, bubble up the exception\n-    raise e\n+  # Deprecated because of that `extra` content limitation. Use `log` instead.\n+  def self.notify_exception(e, extra = {})\n+    log('error', exception: e, **extra)\n   end\n \n-  def self.notify_error(message, additional_data={})\n-    if Rails.env.development? || Rails.env.test?\n-      ::Logger.new(STDOUT).error \"error: \" + message + \"\\n\" + additional_data.inspect + \"\\n\"\n-    end\n-\n-    # Sanity check: Rollbar complains if user is not an object\n-    user = additional_data[:user].respond_to?(:id) ? additional_data[:user] : nil\n-\n-    Rollbar.report_message_with_request(message, 'error', additional_data[:request], user, additional_data)\n+  # Deprecated, use `log`\n+  def self.notify_error(message, additional_data = {})\n+    log('error', message: message, **additional_data)\n   end\n \n   # Add `:request` and `:user` to additional_data if you want request content\n+  # Deprecated, use `log`\n   def self.report_exception(e, message = nil, additional_data = {})\n-    backtrace = e.backtrace ? e.backtrace.join('\\n') : ''\n-    notify_error(message, additional_data.merge(error: e.inspect, backtrace: backtrace))\n+    log('error', exception: e, message: message, **additional_data)\n   end\n \n-  def self.notify_debug(message, additional_data={})\n-    if Rails.env.development? || Rails.env.test?\n-      ::Logger.new(STDOUT).error \"debug: \" + message + \"\\n\" + additional_data.inspect + \"\\n\"\n-    end\n-    Rollbar.report_message(message, 'debug', additional_data)\n+  # Deprecated, use `log`\n+  def self.notify_debug(message, additional_data = {})\n+    log('debug', message: message, **additional_data)\n   end\n \n+  # Deprecated, use `log`\n   def self.notify_warning_exception(exception)\n-    Rollbar.report_exception(exception, nil, nil, 'warning')\n+    log('warning', exception: exception)\n   end\n \n+  def self.log(level, exception: nil, message: nil, user: nil, **additional_data)\n+    if Rails.env.development? || Rails.env.test?\n+      ::Logger.new(STDOUT).error \"#{level}: #{message}\\n\" + exception.inspect + \"\\n\" + additional_data.inspect + \"\\n\"","path":"config/initializers/error_notifier.rb","position":59,"original_position":59,"commit_id":"e871658230bac1fbd4cb218b1e107aeef85d153b","original_commit_id":"e871658230bac1fbd4cb218b1e107aeef85d153b","user":{"login":"juanignaciosl","id":932968,"avatar_url":"https://avatars.githubusercontent.com/u/932968?v=3","gravatar_id":"","url":"https://api.github.com/users/juanignaciosl","html_url":"https://github.com/juanignaciosl","followers_url":"https://api.github.com/users/juanignaciosl/followers","following_url":"https://api.github.com/users/juanignaciosl/following{/other_user}","gists_url":"https://api.github.com/users/juanignaciosl/gists{/gist_id}","starred_url":"https://api.github.com/users/juanignaciosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanignaciosl/subscriptions","organizations_url":"https://api.github.com/users/juanignaciosl/orgs","repos_url":"https://api.github.com/users/juanignaciosl/repos","events_url":"https://api.github.com/users/juanignaciosl/events{/privacy}","received_events_url":"https://api.github.com/users/juanignaciosl/received_events","type":"User","site_admin":false},"body":"Log `user` and `exception.backtrace` (which is not read by `.inspect`) as well, please.","created_at":"2016-03-04T11:28:19Z","updated_at":"2016-03-04T11:28:19Z","html_url":"https://github.com/CartoDB/cartodb/pull/6781#discussion_r55019331","pull_request_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781","_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/55019331"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/6781#discussion_r55019331"},"pull_request":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781"}}},"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781","id":61697826,"html_url":"https://github.com/CartoDB/cartodb/pull/6781","diff_url":"https://github.com/CartoDB/cartodb/pull/6781.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/6781.patch","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/6781","number":6781,"state":"open","locked":false,"title":"[NO MERGE] Create new Rollbar wrappers","user":{"login":"javitonino","id":7569673,"avatar_url":"https://avatars.githubusercontent.com/u/7569673?v=3","gravatar_id":"","url":"https://api.github.com/users/javitonino","html_url":"https://github.com/javitonino","followers_url":"https://api.github.com/users/javitonino/followers","following_url":"https://api.github.com/users/javitonino/following{/other_user}","gists_url":"https://api.github.com/users/javitonino/gists{/gist_id}","starred_url":"https://api.github.com/users/javitonino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javitonino/subscriptions","organizations_url":"https://api.github.com/users/javitonino/orgs","repos_url":"https://api.github.com/users/javitonino/repos","events_url":"https://api.github.com/users/javitonino/events{/privacy}","received_events_url":"https://api.github.com/users/javitonino/received_events","type":"User","site_admin":false},"body":"Do not merge before https://github.com/CartoDB/cartodb/pull/6779\r\nCloses #6778\r\n\r\nThis is a work in progress, here to discuss over code. This creates a new wrapper function CartoDB.log that allows:\r\n- Report exceptions and/or messages. When both are specified, the exception shows up in Rollbar as `<ExceptionClassName>: <message>`, and the detail view shows the stacktrace.\r\n- Specify logging levels: \"critical\", \"error\", \"warning\", \"info\", \"debug\", \"ignore\"\r\n- Automatically adds person and request data. Person data can be overridden by passing the `user` parameter (for retrocompatibility). The same could be done for `request` but it does not seem to be any place in the code where `request` is anything other than `current_request`\r\n\r\nThe old wrappers have been rewritten to call this new one, to have a single point of access to the logging API (except for all Rollbar.* calls in the code). They behave exactly as before except for:\r\n- More context data is added when available (actually a consequence of new rollbar gem)\r\n- If specifying both message and exception to `report_exception`. Before, only the message was reported and the exception only showed in extra data. After, it will show the exception class and message in the listing, and the stacktrace in details.\r\n\r\ncc @juanignaciosl @gfiorav ","created_at":"2016-03-04T11:09:22Z","updated_at":"2016-03-04T11:28:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1032a2c6e7e2cdf17a47c99158d84aea0e16315b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781/commits","review_comments_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781/comments","review_comment_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/6781/comments","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/e871658230bac1fbd4cb218b1e107aeef85d153b","head":{"label":"CartoDB:6778-new_rollbar_wrapper","ref":"6778-new_rollbar_wrapper","sha":"e871658230bac1fbd4cb218b1e107aeef85d153b","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","deployments_url":"https://api.github.com/repos/CartoDB/cartodb/deployments","created_at":"2012-07-05T15:23:45Z","updated_at":"2016-03-01T16:47:45Z","pushed_at":"2016-03-04T11:09:23Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":384577,"stargazers_count":1066,"watchers_count":1066,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":261,"mirror_url":null,"open_issues_count":829,"forks":261,"open_issues":829,"watchers":1066,"default_branch":"master"}},"base":{"label":"CartoDB:master","ref":"master","sha":"5906b7c2ebc7a70c9a34dcac4829d7d280b7ca4d","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","deployments_url":"https://api.github.com/repos/CartoDB/cartodb/deployments","created_at":"2012-07-05T15:23:45Z","updated_at":"2016-03-01T16:47:45Z","pushed_at":"2016-03-04T11:09:23Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":384577,"stargazers_count":1066,"watchers_count":1066,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":261,"mirror_url":null,"open_issues_count":829,"forks":261,"open_issues":829,"watchers":1066,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/6781"},"issue":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/6781"},"comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/6781/comments"},"review_comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781/comments"},"review_comment":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/6781/commits"},"statuses":{"href":"https://api.github.com/repos/CartoDB/cartodb/statuses/e871658230bac1fbd4cb218b1e107aeef85d153b"}}}}