{"action":"created","comment":{"url":"https://api.github.com/repos/mcollina/pino/pulls/comments/78736862","id":78736862,"diff_hunk":"@@ -574,6 +574,18 @@ This has a couple of important caveats:\n   * For instance, a powercut will mean up to 4KB of buffered logs will be lost\n   * A sigkill (or other untrappable signal) will probably result in the same\n   * If writing to a stream other than `process.stdout` or `process.stderr`, there is a slight possibility of lost logs or even partially written logs if the OS buffers don't have enough space, or something else is being written to the stream (or maybe some other reason we've not thought of)\n+* If you supply an alternate stream to the constructor, then that stream must support synchronous writes so that it can be properly flushed on exit. This means the stream most expose its file descriptor via `stream.fd` or `stream._handle.fd`. If your stream is invalid an `error` event will be emitted on the returned logger, e.g.:\n+\n+  ```js\n+  var stream = require('stream')\n+  var pino = require('pino')\n+  var logger = pino({extreme: true}, new stream.Writable({write: function (chunk) {\n+    // do something with chunk\n+  }}))\n+  logger.on('error', function (err) {\n+    // this callback _will_ be invoked for the type of stream we supplied","path":"README.md","position":31,"original_position":31,"commit_id":"c97478479c744647da1ab1854eb63ee112f4ab4d","original_commit_id":"c97478479c744647da1ab1854eb63ee112f4ab4d","user":{"login":"jsumners","id":321201,"avatar_url":"https://avatars.githubusercontent.com/u/321201?v=3","gravatar_id":"","url":"https://api.github.com/users/jsumners","html_url":"https://github.com/jsumners","followers_url":"https://api.github.com/users/jsumners/followers","following_url":"https://api.github.com/users/jsumners/following{/other_user}","gists_url":"https://api.github.com/users/jsumners/gists{/gist_id}","starred_url":"https://api.github.com/users/jsumners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsumners/subscriptions","organizations_url":"https://api.github.com/users/jsumners/orgs","repos_url":"https://api.github.com/users/jsumners/repos","events_url":"https://api.github.com/users/jsumners/events{/privacy}","received_events_url":"https://api.github.com/users/jsumners/received_events","type":"User","site_admin":false},"body":"The comment is simply saying that due to the `stream.Writable` not exposing a file descriptor the error callback will be invoked. And `_will_` is underlined with a traditional ASCII underline for emphasis. Would you rather see this callback?:\r\n\r\n```js\r\nfunction (err) {\r\n  console.error('pino logger cannot flush on exit due to provided output stream')\r\n  process.exit(1)\r\n}\r\n```","created_at":"2016-09-14T12:20:29Z","updated_at":"2016-09-14T12:20:29Z","html_url":"https://github.com/mcollina/pino/pull/84#discussion_r78736862","pull_request_url":"https://api.github.com/repos/mcollina/pino/pulls/84","_links":{"self":{"href":"https://api.github.com/repos/mcollina/pino/pulls/comments/78736862"},"html":{"href":"https://github.com/mcollina/pino/pull/84#discussion_r78736862"},"pull_request":{"href":"https://api.github.com/repos/mcollina/pino/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/mcollina/pino/pulls/84","id":84491554,"html_url":"https://github.com/mcollina/pino/pull/84","diff_url":"https://github.com/mcollina/pino/pull/84.diff","patch_url":"https://github.com/mcollina/pino/pull/84.patch","issue_url":"https://api.github.com/repos/mcollina/pino/issues/84","number":84,"state":"open","locked":false,"title":"Simplify cache flushing","user":{"login":"jsumners","id":321201,"avatar_url":"https://avatars.githubusercontent.com/u/321201?v=3","gravatar_id":"","url":"https://api.github.com/users/jsumners","html_url":"https://github.com/jsumners","followers_url":"https://api.github.com/users/jsumners/followers","following_url":"https://api.github.com/users/jsumners/following{/other_user}","gists_url":"https://api.github.com/users/jsumners/gists{/gist_id}","starred_url":"https://api.github.com/users/jsumners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsumners/subscriptions","organizations_url":"https://api.github.com/users/jsumners/orgs","repos_url":"https://api.github.com/users/jsumners/repos","events_url":"https://api.github.com/users/jsumners/events{/privacy}","received_events_url":"https://api.github.com/users/jsumners/received_events","type":"User","site_admin":false},"body":"This commit eliminates checking the stream against `process.stdout`\r\nand `process.stderr` when flushing the cache on exit. It does so\r\nby forcing the stream into blocking mode by setting the stream's\r\ninternal `_handle` to blocking mode via the V8 `setBlocking` method.\r\n\r\nI opted to unblock the stream after writing out the cache just to be\r\ncomprehensive. I don't believe it is necessary, but I'd rather not\r\nbe the cause of the application hanging indefinitely due to some\r\nedge case as a result of the stream being in blocking mode.","created_at":"2016-09-08T14:45:32Z","updated_at":"2016-09-14T12:20:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea8ceee57ffe2595872c1ae631adb5c6ca63b264","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mcollina/pino/pulls/84/commits","review_comments_url":"https://api.github.com/repos/mcollina/pino/pulls/84/comments","review_comment_url":"https://api.github.com/repos/mcollina/pino/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mcollina/pino/issues/84/comments","statuses_url":"https://api.github.com/repos/mcollina/pino/statuses/c97478479c744647da1ab1854eb63ee112f4ab4d","head":{"label":"jsumners:blocking-cache-flush","ref":"blocking-cache-flush","sha":"c97478479c744647da1ab1854eb63ee112f4ab4d","user":{"login":"jsumners","id":321201,"avatar_url":"https://avatars.githubusercontent.com/u/321201?v=3","gravatar_id":"","url":"https://api.github.com/users/jsumners","html_url":"https://github.com/jsumners","followers_url":"https://api.github.com/users/jsumners/followers","following_url":"https://api.github.com/users/jsumners/following{/other_user}","gists_url":"https://api.github.com/users/jsumners/gists{/gist_id}","starred_url":"https://api.github.com/users/jsumners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsumners/subscriptions","organizations_url":"https://api.github.com/users/jsumners/orgs","repos_url":"https://api.github.com/users/jsumners/repos","events_url":"https://api.github.com/users/jsumners/events{/privacy}","received_events_url":"https://api.github.com/users/jsumners/received_events","type":"User","site_admin":false},"repo":{"id":57900446,"name":"pino","full_name":"jsumners/pino","owner":{"login":"jsumners","id":321201,"avatar_url":"https://avatars.githubusercontent.com/u/321201?v=3","gravatar_id":"","url":"https://api.github.com/users/jsumners","html_url":"https://github.com/jsumners","followers_url":"https://api.github.com/users/jsumners/followers","following_url":"https://api.github.com/users/jsumners/following{/other_user}","gists_url":"https://api.github.com/users/jsumners/gists{/gist_id}","starred_url":"https://api.github.com/users/jsumners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsumners/subscriptions","organizations_url":"https://api.github.com/users/jsumners/orgs","repos_url":"https://api.github.com/users/jsumners/repos","events_url":"https://api.github.com/users/jsumners/events{/privacy}","received_events_url":"https://api.github.com/users/jsumners/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsumners/pino","description":"fast and simple node.js logger","fork":true,"url":"https://api.github.com/repos/jsumners/pino","forks_url":"https://api.github.com/repos/jsumners/pino/forks","keys_url":"https://api.github.com/repos/jsumners/pino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsumners/pino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsumners/pino/teams","hooks_url":"https://api.github.com/repos/jsumners/pino/hooks","issue_events_url":"https://api.github.com/repos/jsumners/pino/issues/events{/number}","events_url":"https://api.github.com/repos/jsumners/pino/events","assignees_url":"https://api.github.com/repos/jsumners/pino/assignees{/user}","branches_url":"https://api.github.com/repos/jsumners/pino/branches{/branch}","tags_url":"https://api.github.com/repos/jsumners/pino/tags","blobs_url":"https://api.github.com/repos/jsumners/pino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsumners/pino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsumners/pino/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsumners/pino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsumners/pino/statuses/{sha}","languages_url":"https://api.github.com/repos/jsumners/pino/languages","stargazers_url":"https://api.github.com/repos/jsumners/pino/stargazers","contributors_url":"https://api.github.com/repos/jsumners/pino/contributors","subscribers_url":"https://api.github.com/repos/jsumners/pino/subscribers","subscription_url":"https://api.github.com/repos/jsumners/pino/subscription","commits_url":"https://api.github.com/repos/jsumners/pino/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsumners/pino/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsumners/pino/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsumners/pino/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsumners/pino/contents/{+path}","compare_url":"https://api.github.com/repos/jsumners/pino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsumners/pino/merges","archive_url":"https://api.github.com/repos/jsumners/pino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsumners/pino/downloads","issues_url":"https://api.github.com/repos/jsumners/pino/issues{/number}","pulls_url":"https://api.github.com/repos/jsumners/pino/pulls{/number}","milestones_url":"https://api.github.com/repos/jsumners/pino/milestones{/number}","notifications_url":"https://api.github.com/repos/jsumners/pino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsumners/pino/labels{/name}","releases_url":"https://api.github.com/repos/jsumners/pino/releases{/id}","deployments_url":"https://api.github.com/repos/jsumners/pino/deployments","created_at":"2016-05-02T15:35:34Z","updated_at":"2016-08-10T13:17:13Z","pushed_at":"2016-09-13T17:25:09Z","git_url":"git://github.com/jsumners/pino.git","ssh_url":"git@github.com:jsumners/pino.git","clone_url":"https://github.com/jsumners/pino.git","svn_url":"https://github.com/jsumners/pino","homepage":"","size":828,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"mcollina:master","ref":"master","sha":"ca7269214cf8d63d8040144383f88b4980b8e86e","user":{"login":"mcollina","id":52195,"avatar_url":"https://avatars.githubusercontent.com/u/52195?v=3","gravatar_id":"","url":"https://api.github.com/users/mcollina","html_url":"https://github.com/mcollina","followers_url":"https://api.github.com/users/mcollina/followers","following_url":"https://api.github.com/users/mcollina/following{/other_user}","gists_url":"https://api.github.com/users/mcollina/gists{/gist_id}","starred_url":"https://api.github.com/users/mcollina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcollina/subscriptions","organizations_url":"https://api.github.com/users/mcollina/orgs","repos_url":"https://api.github.com/users/mcollina/repos","events_url":"https://api.github.com/users/mcollina/events{/privacy}","received_events_url":"https://api.github.com/users/mcollina/received_events","type":"User","site_admin":false},"repo":{"id":51840802,"name":"pino","full_name":"mcollina/pino","owner":{"login":"mcollina","id":52195,"avatar_url":"https://avatars.githubusercontent.com/u/52195?v=3","gravatar_id":"","url":"https://api.github.com/users/mcollina","html_url":"https://github.com/mcollina","followers_url":"https://api.github.com/users/mcollina/followers","following_url":"https://api.github.com/users/mcollina/following{/other_user}","gists_url":"https://api.github.com/users/mcollina/gists{/gist_id}","starred_url":"https://api.github.com/users/mcollina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcollina/subscriptions","organizations_url":"https://api.github.com/users/mcollina/orgs","repos_url":"https://api.github.com/users/mcollina/repos","events_url":"https://api.github.com/users/mcollina/events{/privacy}","received_events_url":"https://api.github.com/users/mcollina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcollina/pino","description":"super fast, all natural json logger","fork":false,"url":"https://api.github.com/repos/mcollina/pino","forks_url":"https://api.github.com/repos/mcollina/pino/forks","keys_url":"https://api.github.com/repos/mcollina/pino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcollina/pino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcollina/pino/teams","hooks_url":"https://api.github.com/repos/mcollina/pino/hooks","issue_events_url":"https://api.github.com/repos/mcollina/pino/issues/events{/number}","events_url":"https://api.github.com/repos/mcollina/pino/events","assignees_url":"https://api.github.com/repos/mcollina/pino/assignees{/user}","branches_url":"https://api.github.com/repos/mcollina/pino/branches{/branch}","tags_url":"https://api.github.com/repos/mcollina/pino/tags","blobs_url":"https://api.github.com/repos/mcollina/pino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcollina/pino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcollina/pino/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcollina/pino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcollina/pino/statuses/{sha}","languages_url":"https://api.github.com/repos/mcollina/pino/languages","stargazers_url":"https://api.github.com/repos/mcollina/pino/stargazers","contributors_url":"https://api.github.com/repos/mcollina/pino/contributors","subscribers_url":"https://api.github.com/repos/mcollina/pino/subscribers","subscription_url":"https://api.github.com/repos/mcollina/pino/subscription","commits_url":"https://api.github.com/repos/mcollina/pino/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcollina/pino/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcollina/pino/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcollina/pino/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcollina/pino/contents/{+path}","compare_url":"https://api.github.com/repos/mcollina/pino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcollina/pino/merges","archive_url":"https://api.github.com/repos/mcollina/pino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcollina/pino/downloads","issues_url":"https://api.github.com/repos/mcollina/pino/issues{/number}","pulls_url":"https://api.github.com/repos/mcollina/pino/pulls{/number}","milestones_url":"https://api.github.com/repos/mcollina/pino/milestones{/number}","notifications_url":"https://api.github.com/repos/mcollina/pino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcollina/pino/labels{/name}","releases_url":"https://api.github.com/repos/mcollina/pino/releases{/id}","deployments_url":"https://api.github.com/repos/mcollina/pino/deployments","created_at":"2016-02-16T14:14:29Z","updated_at":"2016-09-13T18:25:54Z","pushed_at":"2016-09-14T07:51:10Z","git_url":"git://github.com/mcollina/pino.git","ssh_url":"git@github.com:mcollina/pino.git","clone_url":"https://github.com/mcollina/pino.git","svn_url":"https://github.com/mcollina/pino","homepage":"","size":856,"stargazers_count":330,"watchers_count":330,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":4,"forks":22,"open_issues":4,"watchers":330,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mcollina/pino/pulls/84"},"html":{"href":"https://github.com/mcollina/pino/pull/84"},"issue":{"href":"https://api.github.com/repos/mcollina/pino/issues/84"},"comments":{"href":"https://api.github.com/repos/mcollina/pino/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/mcollina/pino/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/mcollina/pino/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mcollina/pino/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/mcollina/pino/statuses/c97478479c744647da1ab1854eb63ee112f4ab4d"}}}}
{"actor":{"display_login":"jsumners"}}