{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/44279208","id":44279208,"diff_hunk":"@@ -0,0 +1,112 @@\n+##\n+# ActiveModelSerializers::Logging\n+#\n+#   https://github.com/rails/rails/blob/280654ef88/activejob/lib/active_job/logging.rb\n+#\n+module ActiveModelSerializers::Logging\n+  extend ActiveSupport::Concern\n+\n+  included do\n+    include ActiveModelSerializers::Callbacks\n+    extend NotificationMacro\n+    instrument_rendering\n+  end\n+\n+  module ClassMethods\n+    def instrument_rendering\n+      around_render do |args, block|\n+        tag_logger do\n+          notify_render do\n+            block.call(args)\n+          end\n+        end\n+      end\n+    end\n+  end\n+\n+  # Adapted from:\n+  #   https://github.com/rubygems/rubygems/blob/cb28f5e991/lib/rubygems/deprecate.rb\n+  # Provides a single method +notify+ to be used to declare when\n+  # something a method notifies, with the argument +callback_name+ of the notification callback.\n+  #\n+  #     class Adapter\n+  #       def self.klass_method\n+  #         # ...\n+  #       end\n+  #\n+  #       def instance_method\n+  #         # ...\n+  #       end\n+  #\n+  #       include ActiveModelSerializers::Logging\n+  #       notify :instance_method, :render\n+  #\n+  #       class << self\n+  #         extend ActiveModelSerializers::Logging::NotificationMacro\n+  #         notify :klass_method, :render\n+  #       end\n+  #     end\n+  module NotificationMacro","path":"lib/active_model_serializers/logging.rb","position":49,"original_position":49,"commit_id":"fcb8b054f69f59b2a0bd878b43729479142a76ea","original_commit_id":"fcb8b054f69f59b2a0bd878b43729479142a76ea","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":"I thought about it... Wasn't sure where it belonged... Do you think one class is more obvious than the other? Or too manyvor few files?\n\nB mobile phone\n\n> On Nov 9, 2015, at 6:56 AM, Mauro George <notifications@github.com> wrote:\n> \n> In lib/active_model_serializers/logging.rb:\n> \n> > +  #         # ...\n> > +  #       end\n> > +  #\n> > +  #       def instance_method\n> > +  #         # ...\n> > +  #       end\n> > +  #\n> > +  #       include ActiveModelSerializers::Logging\n> > +  #       notify :instance_method, :render\n> > +  #\n> > +  #       class << self\n> > +  #         extend ActiveModelSerializers::Logging::NotificationMacro\n> > +  #         notify :klass_method, :render\n> > +  #       end\n> > +  #     end\n> > +  module NotificationMacro\n> Make sense this leave in a ActiveModelSerializers::Notification namespace over the Logging?\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n","created_at":"2015-11-09T14:23:55Z","updated_at":"2015-11-09T14:23:55Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1322#discussion_r44279208","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/44279208"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1322#discussion_r44279208"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322","id":50071369,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1322","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1322.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1322.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1322","number":1322,"state":"open","locked":false,"title":"Instrumenting rendering of resources","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":"Building on the very excellent PR by @maurogeorge (all squashed)\n\nhttps://github.com/rails-api/active_model_serializers/pull/1291","created_at":"2015-11-08T21:54:54Z","updated_at":"2015-11-09T14:23:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"266b995eca5641aefe2e0848aae362041b2b2a41","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322/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/1322/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/fcb8b054f69f59b2a0bd878b43729479142a76ea","head":{"label":"bf4:maurogeorge-patch-10","ref":"maurogeorge-patch-10","sha":"fcb8b054f69f59b2a0bd878b43729479142a76ea","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},"repo":{"id":31333715,"name":"active_model_serializers","full_name":"bf4/active_model_serializers","owner":{"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},"private":false,"html_url":"https://github.com/bf4/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/bf4/active_model_serializers","forks_url":"https://api.github.com/repos/bf4/active_model_serializers/forks","keys_url":"https://api.github.com/repos/bf4/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bf4/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bf4/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/bf4/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/bf4/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/bf4/active_model_serializers/events","assignees_url":"https://api.github.com/repos/bf4/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/bf4/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/bf4/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/bf4/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bf4/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bf4/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/bf4/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bf4/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/bf4/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/bf4/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/bf4/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/bf4/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/bf4/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/bf4/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/bf4/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/bf4/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/bf4/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/bf4/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/bf4/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bf4/active_model_serializers/merges","archive_url":"https://api.github.com/repos/bf4/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bf4/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/bf4/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/bf4/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/bf4/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/bf4/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bf4/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/bf4/active_model_serializers/releases{/id}","created_at":"2015-02-25T20:15:49Z","updated_at":"2015-02-25T20:15:50Z","pushed_at":"2015-11-09T06:35:07Z","git_url":"git://github.com/bf4/active_model_serializers.git","ssh_url":"git@github.com:bf4/active_model_serializers.git","clone_url":"https://github.com/bf4/active_model_serializers.git","svn_url":"https://github.com/bf4/active_model_serializers","homepage":"","size":2463,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"0-8-stable"}},"base":{"label":"rails-api:master","ref":"master","sha":"efe5128a2e6b8578d81bc7a807ace427c0b4d847","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-09T12:16:16Z","pushed_at":"2015-11-09T06:35:07Z","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":3108,"watchers_count":3108,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":726,"mirror_url":null,"open_issues_count":180,"forks":726,"open_issues":180,"watchers":3108,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1322"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1322"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1322/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1322/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/1322/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/fcb8b054f69f59b2a0bd878b43729479142a76ea"}}}}