{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/43976016","id":43976016,"diff_hunk":"@@ -0,0 +1,26 @@\n+module ActiveModel\n+  class Serializer\n+    module Logging\n+      extend ActiveSupport::Concern\n+\n+      class LogSubscriber < ActiveSupport::LogSubscriber\n+        def render(event)\n+          logger.tagged('AMS') do\n+            info do\n+              serializer = event.payload[:serializer]\n+              adapter = event.payload[:adapter]\n+              duration = event.duration.round(2)\n+              \"Rendered #{serializer.name} with #{adapter.class} (#{duration}ms)\"\n+            end\n+          end\n+        end\n+\n+        def logger\n+          ActiveModelSerializers.logger\n+        end\n+      end\n+    end\n+  end\n+end\n+\n+ActiveModel::Serializer::Logging::LogSubscriber.attach_to :active_model_serializers","path":"lib/active_model/serializer/logging.rb","position":26,"original_position":26,"commit_id":"2c4a028bed946d10b2972c975ef9c2501ef43c25","original_commit_id":"2c4a028bed946d10b2972c975ef9c2501ef43c25","user":{"login":"bf4","id":142914,"avatar_url":"https://avatars.githubusercontent.com/u/142914?v=3","gravatar_id":"","url":"https://api.github.com/users/bf4","html_url":"https://github.com/bf4","followers_url":"https://api.github.com/users/bf4/followers","following_url":"https://api.github.com/users/bf4/following{/other_user}","gists_url":"https://api.github.com/users/bf4/gists{/gist_id}","starred_url":"https://api.github.com/users/bf4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bf4/subscriptions","organizations_url":"https://api.github.com/users/bf4/orgs","repos_url":"https://api.github.com/users/bf4/repos","events_url":"https://api.github.com/users/bf4/events{/privacy}","received_events_url":"https://api.github.com/users/bf4/received_events","type":"User","site_admin":false},"body":"should be configured in the railtie","created_at":"2015-11-05T04:44:29Z","updated_at":"2015-11-05T04:44:29Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1291#discussion_r43976016","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/43976016"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1291#discussion_r43976016"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291","id":48516071,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1291","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1291.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1291.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1291","number":1291,"state":"open","locked":false,"title":"Add Logging","user":{"login":"maurogeorge","id":260746,"avatar_url":"https://avatars.githubusercontent.com/u/260746?v=3","gravatar_id":"","url":"https://api.github.com/users/maurogeorge","html_url":"https://github.com/maurogeorge","followers_url":"https://api.github.com/users/maurogeorge/followers","following_url":"https://api.github.com/users/maurogeorge/following{/other_user}","gists_url":"https://api.github.com/users/maurogeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/maurogeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurogeorge/subscriptions","organizations_url":"https://api.github.com/users/maurogeorge/orgs","repos_url":"https://api.github.com/users/maurogeorge/repos","events_url":"https://api.github.com/users/maurogeorge/events{/privacy}","received_events_url":"https://api.github.com/users/maurogeorge/received_events","type":"User","site_admin":false},"body":"Hi guys,\r\n\r\nI think today we do not logging nothing right? Based on [this](https://github.com/rails-api/active_model_serializers/pull/1099#discussion_r42184548) I started working on a logging using `ActiveSupport::Notifications` and `ActiveSupport::LogSubscriber`.\r\n\r\nThe actual log output on this patch is:\r\n\r\n```\r\n[AMS] Rendered PostSerializer with ActiveModel::Serializer::Adapter::JsonApi (5.72ms)\r\n```\r\n\r\nThis makes sense to you guys? If make sense I can continue working on it.","created_at":"2015-10-22T21:33:40Z","updated_at":"2015-11-05T04:44:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e6e9aeb85ebbf4b3c0903c4226c47c8b1836d9d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291/comments","review_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1291/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/2c4a028bed946d10b2972c975ef9c2501ef43c25","head":{"label":"maurogeorge:patch-10","ref":"patch-10","sha":"2c4a028bed946d10b2972c975ef9c2501ef43c25","user":{"login":"maurogeorge","id":260746,"avatar_url":"https://avatars.githubusercontent.com/u/260746?v=3","gravatar_id":"","url":"https://api.github.com/users/maurogeorge","html_url":"https://github.com/maurogeorge","followers_url":"https://api.github.com/users/maurogeorge/followers","following_url":"https://api.github.com/users/maurogeorge/following{/other_user}","gists_url":"https://api.github.com/users/maurogeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/maurogeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurogeorge/subscriptions","organizations_url":"https://api.github.com/users/maurogeorge/orgs","repos_url":"https://api.github.com/users/maurogeorge/repos","events_url":"https://api.github.com/users/maurogeorge/events{/privacy}","received_events_url":"https://api.github.com/users/maurogeorge/received_events","type":"User","site_admin":false},"repo":{"id":41603084,"name":"active_model_serializers","full_name":"maurogeorge/active_model_serializers","owner":{"login":"maurogeorge","id":260746,"avatar_url":"https://avatars.githubusercontent.com/u/260746?v=3","gravatar_id":"","url":"https://api.github.com/users/maurogeorge","html_url":"https://github.com/maurogeorge","followers_url":"https://api.github.com/users/maurogeorge/followers","following_url":"https://api.github.com/users/maurogeorge/following{/other_user}","gists_url":"https://api.github.com/users/maurogeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/maurogeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maurogeorge/subscriptions","organizations_url":"https://api.github.com/users/maurogeorge/orgs","repos_url":"https://api.github.com/users/maurogeorge/repos","events_url":"https://api.github.com/users/maurogeorge/events{/privacy}","received_events_url":"https://api.github.com/users/maurogeorge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maurogeorge/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/maurogeorge/active_model_serializers","forks_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/forks","keys_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/events","assignees_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/merges","archive_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/maurogeorge/active_model_serializers/releases{/id}","created_at":"2015-08-29T18:24:04Z","updated_at":"2015-08-29T18:24:05Z","pushed_at":"2015-10-29T22:30:48Z","git_url":"git://github.com/maurogeorge/active_model_serializers.git","ssh_url":"git@github.com:maurogeorge/active_model_serializers.git","clone_url":"https://github.com/maurogeorge/active_model_serializers.git","svn_url":"https://github.com/maurogeorge/active_model_serializers","homepage":"","size":2206,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"rails-api:master","ref":"master","sha":"f3403c302c46fd470c2c6073d6cc6c364d9c5bd0","user":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"repo":{"id":2889230,"name":"active_model_serializers","full_name":"rails-api/active_model_serializers","owner":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails-api/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":false,"url":"https://api.github.com/repos/rails-api/active_model_serializers","forks_url":"https://api.github.com/repos/rails-api/active_model_serializers/forks","keys_url":"https://api.github.com/repos/rails-api/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails-api/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails-api/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/rails-api/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/events","assignees_url":"https://api.github.com/repos/rails-api/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/rails-api/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/rails-api/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/rails-api/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/rails-api/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails-api/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/rails-api/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails-api/active_model_serializers/merges","archive_url":"https://api.github.com/repos/rails-api/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails-api/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/rails-api/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/rails-api/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/rails-api/active_model_serializers/releases{/id}","created_at":"2011-12-01T06:39:26Z","updated_at":"2015-11-05T03:54:58Z","pushed_at":"2015-11-04T17:12:12Z","git_url":"git://github.com/rails-api/active_model_serializers.git","ssh_url":"git@github.com:rails-api/active_model_serializers.git","clone_url":"https://github.com/rails-api/active_model_serializers.git","svn_url":"https://github.com/rails-api/active_model_serializers","homepage":"","size":7977,"stargazers_count":3102,"watchers_count":3102,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":722,"mirror_url":null,"open_issues_count":179,"forks":722,"open_issues":179,"watchers":3102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1291"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1291"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1291/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291/comments"},"review_comment":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1291/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/2c4a028bed946d10b2972c975ef9c2501ef43c25"}}}}