{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments/170164270","pull_request_review_id":98809807,"id":170164270,"diff_hunk":"@@ -0,0 +1,60 @@\n+package Log::Log4perl::Layout::Mozilla;\n+use 5.10.1;\n+use Moo;\n+use Sys::Hostname;\n+use JSON::MaybeXS ();\n+use English qw(-no_match_vars $PID);\n+\n+use constant LOGGING_FORMAT_VERSION => \"2.0\";\n+\n+extends 'Log::Log4perl::Layout';\n+\n+has 'name' => (\n+    is      => 'ro',\n+    default => 'Bugzilla',\n+);\n+\n+has 'max_json_length' => (\n+    is      => 'ro',\n+    isa     => sub { die \"must be at least 1024\\n\" if $_[0] < 1024 },\n+    default => 4096,\n+);\n+\n+sub render {\n+    my ( $self, $message, $category, $priority, $caller_level ) = @_;\n+\n+    state $HOSTNAME = hostname();\n+    state $JSON     = JSON::MaybeXS->new(\n+        indent          => 0,    # to prevent newlines (and save space)\n+        ascii           => 1,    # to avoid encoding issues downstream\n+        allow_unknown   => 1,    # encode null on bad value (instead of exception)\n+        convert_blessed => 1,    # call TO_JSON on blessed ref, if it exists\n+        allow_blessed   => 1,    # encode null on blessed ref that can't be converted\n+    );\n+\n+    my $mdc_context = Log::Log4perl::MDC->get_context;\n+    my %fields = (\n+        message => $message,\n+        %$mdc_context,\n+    );\n+    my %out = (\n+        Timestamp => time() * 1e9,\n+        Type      => $category,\n+        Logger    => $self->name,\n+        Hostname  => $HOSTNAME,\n+        EnvVersion => LOGGING_FORMAT_VERSION,\n+        Severity   => $Log::Log4perl::Level::SYSLOG{$priority},\n+        Fields     => \\%fields,\n+        Pid        => $PID,\n+    );\n+    my $json_text = $JSON->encode(\\%out) . \"\\n\";\n+    if (length($json_text) > $self->max_json_length) {\n+        %fields = (\n+            message => sprintf(\"msg is larger than %d: %d\", $self->max_json_length, length($json_text))\n+        );","path":"Log/Log4perl/Layout/Mozilla.pm","position":54,"original_position":54,"commit_id":"0b5d108c07f107b9cffa9fde8479fec464975abb","original_commit_id":"0b5d108c07f107b9cffa9fde8479fec464975abb","user":{"login":"globau","id":872825,"avatar_url":"https://avatars3.githubusercontent.com/u/872825?v=4","gravatar_id":"","url":"https://api.github.com/users/globau","html_url":"https://github.com/globau","followers_url":"https://api.github.com/users/globau/followers","following_url":"https://api.github.com/users/globau/following{/other_user}","gists_url":"https://api.github.com/users/globau/gists{/gist_id}","starred_url":"https://api.github.com/users/globau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globau/subscriptions","organizations_url":"https://api.github.com/users/globau/orgs","repos_url":"https://api.github.com/users/globau/repos","events_url":"https://api.github.com/users/globau/events{/privacy}","received_events_url":"https://api.github.com/users/globau/received_events","type":"User","site_admin":false},"body":"it may be better to just change $fields{message} so the MDC context fields are retained.","created_at":"2018-02-23T04:27:26Z","updated_at":"2018-02-23T04:27:26Z","html_url":"https://github.com/mozilla-bteam/bmo/pull/402#discussion_r170164270","pull_request_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments/170164270"},"html":{"href":"https://github.com/mozilla-bteam/bmo/pull/402#discussion_r170164270"},"pull_request":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402","id":169887820,"html_url":"https://github.com/mozilla-bteam/bmo/pull/402","diff_url":"https://github.com/mozilla-bteam/bmo/pull/402.diff","patch_url":"https://github.com/mozilla-bteam/bmo/pull/402.patch","issue_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/402","number":402,"state":"open","locked":false,"title":"implement rough draft of audit log stuff","user":{"login":"dylanwh","id":47717,"avatar_url":"https://avatars0.githubusercontent.com/u/47717?v=4","gravatar_id":"","url":"https://api.github.com/users/dylanwh","html_url":"https://github.com/dylanwh","followers_url":"https://api.github.com/users/dylanwh/followers","following_url":"https://api.github.com/users/dylanwh/following{/other_user}","gists_url":"https://api.github.com/users/dylanwh/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanwh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanwh/subscriptions","organizations_url":"https://api.github.com/users/dylanwh/orgs","repos_url":"https://api.github.com/users/dylanwh/repos","events_url":"https://api.github.com/users/dylanwh/events{/privacy}","received_events_url":"https://api.github.com/users/dylanwh/received_events","type":"User","site_admin":false},"body":null,"created_at":"2018-02-19T06:38:59Z","updated_at":"2018-02-23T04:27:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a35936dce60772028dcee0d9eb5f9e873a0182ed","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402/commits","review_comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402/comments","review_comment_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/402/comments","statuses_url":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/0b5d108c07f107b9cffa9fde8479fec464975abb","head":{"label":"dylanwh:logging-fun","ref":"logging-fun","sha":"0b5d108c07f107b9cffa9fde8479fec464975abb","user":{"login":"dylanwh","id":47717,"avatar_url":"https://avatars0.githubusercontent.com/u/47717?v=4","gravatar_id":"","url":"https://api.github.com/users/dylanwh","html_url":"https://github.com/dylanwh","followers_url":"https://api.github.com/users/dylanwh/followers","following_url":"https://api.github.com/users/dylanwh/following{/other_user}","gists_url":"https://api.github.com/users/dylanwh/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanwh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanwh/subscriptions","organizations_url":"https://api.github.com/users/dylanwh/orgs","repos_url":"https://api.github.com/users/dylanwh/repos","events_url":"https://api.github.com/users/dylanwh/events{/privacy}","received_events_url":"https://api.github.com/users/dylanwh/received_events","type":"User","site_admin":false},"repo":{"id":62352733,"name":"bmo","full_name":"dylanwh/bmo","owner":{"login":"dylanwh","id":47717,"avatar_url":"https://avatars0.githubusercontent.com/u/47717?v=4","gravatar_id":"","url":"https://api.github.com/users/dylanwh","html_url":"https://github.com/dylanwh","followers_url":"https://api.github.com/users/dylanwh/followers","following_url":"https://api.github.com/users/dylanwh/following{/other_user}","gists_url":"https://api.github.com/users/dylanwh/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanwh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanwh/subscriptions","organizations_url":"https://api.github.com/users/dylanwh/orgs","repos_url":"https://api.github.com/users/dylanwh/repos","events_url":"https://api.github.com/users/dylanwh/events{/privacy}","received_events_url":"https://api.github.com/users/dylanwh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dylanwh/bmo","description":"bugzilla.mozilla.org source","fork":true,"url":"https://api.github.com/repos/dylanwh/bmo","forks_url":"https://api.github.com/repos/dylanwh/bmo/forks","keys_url":"https://api.github.com/repos/dylanwh/bmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dylanwh/bmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dylanwh/bmo/teams","hooks_url":"https://api.github.com/repos/dylanwh/bmo/hooks","issue_events_url":"https://api.github.com/repos/dylanwh/bmo/issues/events{/number}","events_url":"https://api.github.com/repos/dylanwh/bmo/events","assignees_url":"https://api.github.com/repos/dylanwh/bmo/assignees{/user}","branches_url":"https://api.github.com/repos/dylanwh/bmo/branches{/branch}","tags_url":"https://api.github.com/repos/dylanwh/bmo/tags","blobs_url":"https://api.github.com/repos/dylanwh/bmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dylanwh/bmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dylanwh/bmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/dylanwh/bmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dylanwh/bmo/statuses/{sha}","languages_url":"https://api.github.com/repos/dylanwh/bmo/languages","stargazers_url":"https://api.github.com/repos/dylanwh/bmo/stargazers","contributors_url":"https://api.github.com/repos/dylanwh/bmo/contributors","subscribers_url":"https://api.github.com/repos/dylanwh/bmo/subscribers","subscription_url":"https://api.github.com/repos/dylanwh/bmo/subscription","commits_url":"https://api.github.com/repos/dylanwh/bmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/dylanwh/bmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/dylanwh/bmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/dylanwh/bmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/dylanwh/bmo/contents/{+path}","compare_url":"https://api.github.com/repos/dylanwh/bmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dylanwh/bmo/merges","archive_url":"https://api.github.com/repos/dylanwh/bmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dylanwh/bmo/downloads","issues_url":"https://api.github.com/repos/dylanwh/bmo/issues{/number}","pulls_url":"https://api.github.com/repos/dylanwh/bmo/pulls{/number}","milestones_url":"https://api.github.com/repos/dylanwh/bmo/milestones{/number}","notifications_url":"https://api.github.com/repos/dylanwh/bmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dylanwh/bmo/labels{/name}","releases_url":"https://api.github.com/repos/dylanwh/bmo/releases{/id}","deployments_url":"https://api.github.com/repos/dylanwh/bmo/deployments","created_at":"2016-07-01T01:21:13Z","updated_at":"2016-11-08T20:05:44Z","pushed_at":"2018-02-23T04:07:56Z","git_url":"git://github.com/dylanwh/bmo.git","ssh_url":"git@github.com:dylanwh/bmo.git","clone_url":"https://github.com/dylanwh/bmo.git","svn_url":"https://github.com/dylanwh/bmo","homepage":"","size":45421,"stargazers_count":1,"watchers_count":1,"language":"Perl","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":3,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla-bteam:master","ref":"master","sha":"dc8462848e2b6849c36f81abbda57d210dded7bd","user":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars3.githubusercontent.com/u/18560992?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"repo":{"id":17650869,"name":"bmo","full_name":"mozilla-bteam/bmo","owner":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars3.githubusercontent.com/u/18560992?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-bteam/bmo","description":"bugzilla.mozilla.org source - report issues here: https://bugzilla.mozilla.org/new-bug#bugzilla.mozilla.org","fork":false,"url":"https://api.github.com/repos/mozilla-bteam/bmo","forks_url":"https://api.github.com/repos/mozilla-bteam/bmo/forks","keys_url":"https://api.github.com/repos/mozilla-bteam/bmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-bteam/bmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-bteam/bmo/teams","hooks_url":"https://api.github.com/repos/mozilla-bteam/bmo/hooks","issue_events_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-bteam/bmo/events","assignees_url":"https://api.github.com/repos/mozilla-bteam/bmo/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-bteam/bmo/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/tags","blobs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-bteam/bmo/languages","stargazers_url":"https://api.github.com/repos/mozilla-bteam/bmo/stargazers","contributors_url":"https://api.github.com/repos/mozilla-bteam/bmo/contributors","subscribers_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscribers","subscription_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscription","commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-bteam/bmo/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-bteam/bmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-bteam/bmo/merges","archive_url":"https://api.github.com/repos/mozilla-bteam/bmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-bteam/bmo/downloads","issues_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-bteam/bmo/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-bteam/bmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-bteam/bmo/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-bteam/bmo/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-bteam/bmo/deployments","created_at":"2014-03-12T01:03:55Z","updated_at":"2018-02-05T20:11:29Z","pushed_at":"2018-02-23T04:07:58Z","git_url":"git://github.com/mozilla-bteam/bmo.git","ssh_url":"git@github.com:mozilla-bteam/bmo.git","clone_url":"https://github.com/mozilla-bteam/bmo.git","svn_url":"https://github.com/mozilla-bteam/bmo","homepage":"","size":42379,"stargazers_count":43,"watchers_count":43,"language":"Perl","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"archived":false,"open_issues_count":44,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":80,"open_issues":44,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402"},"html":{"href":"https://github.com/mozilla-bteam/bmo/pull/402"},"issue":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/issues/402"},"comments":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/issues/402/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/402/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/0b5d108c07f107b9cffa9fde8479fec464975abb"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"globau"}}