{"action":"created","issue":{"url":"https://api.github.com/repos/hapijs/good/issues/315","labels_url":"https://api.github.com/repos/hapijs/good/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/hapijs/good/issues/315/comments","events_url":"https://api.github.com/repos/hapijs/good/issues/315/events","html_url":"https://github.com/hapijs/good/issues/315","id":64320087,"number":315,"title":"Be able to filter sensitive information ","user":{"login":"danielb2","id":26678,"avatar_url":"https://avatars.githubusercontent.com/u/26678?v=3","gravatar_id":"","url":"https://api.github.com/users/danielb2","html_url":"https://github.com/danielb2","followers_url":"https://api.github.com/users/danielb2/followers","following_url":"https://api.github.com/users/danielb2/following{/other_user}","gists_url":"https://api.github.com/users/danielb2/gists{/gist_id}","starred_url":"https://api.github.com/users/danielb2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielb2/subscriptions","organizations_url":"https://api.github.com/users/danielb2/orgs","repos_url":"https://api.github.com/users/danielb2/repos","events_url":"https://api.github.com/users/danielb2/events{/privacy}","received_events_url":"https://api.github.com/users/danielb2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hapijs/good/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-03-25T16:58:51Z","updated_at":"2015-04-10T17:01:31Z","closed_at":null,"body":"Sensitive information like creditcard information or passwords is likely to not want to be logged for security reasons.\r\n\r\nModifying and forking reporters for each and every single case isn't practical (once for file logging, for console, for udp, etc)\r\n\r\nHow this is to be done can be discussed. Perhaps a callback filter function, or a plugin for good itself.\r\n\r\nSee https://www.npmjs.com/package/blur  for reference"},"comment":{"url":"https://api.github.com/repos/hapijs/good/issues/comments/91622068","html_url":"https://github.com/hapijs/good/issues/315#issuecomment-91622068","issue_url":"https://api.github.com/repos/hapijs/good/issues/315","id":91622068,"user":{"login":"gergoerdosi","id":371149,"avatar_url":"https://avatars.githubusercontent.com/u/371149?v=3","gravatar_id":"","url":"https://api.github.com/users/gergoerdosi","html_url":"https://github.com/gergoerdosi","followers_url":"https://api.github.com/users/gergoerdosi/followers","following_url":"https://api.github.com/users/gergoerdosi/following{/other_user}","gists_url":"https://api.github.com/users/gergoerdosi/gists{/gist_id}","starred_url":"https://api.github.com/users/gergoerdosi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gergoerdosi/subscriptions","organizations_url":"https://api.github.com/users/gergoerdosi/orgs","repos_url":"https://api.github.com/users/gergoerdosi/repos","events_url":"https://api.github.com/users/gergoerdosi/events{/privacy}","received_events_url":"https://api.github.com/users/gergoerdosi/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T17:01:31Z","updated_at":"2015-04-10T17:01:31Z","body":"How about using a regex instead of `n:partial` or `partial:n`? So:\r\n\r\n```javascript\r\ncreditcard: /(\\d{4})$/\r\n```\r\n\r\nWe could then have a basic function that replaces the matched string with `X` characters, something like:\r\n\r\n```javascript\r\nstring = string.replace(regex, function ($0, $1) {\r\n    \r\n    return (new Array($1.length + 1).join('X'));\r\n});\r\n```\r\n\r\nUsing a regex would allow more complex cases too:\r\n\r\n* `/(\\d{4})$/`: `12345678` -> `1234XXXX`\r\n* `/^(\\d{4})/`: `12345678` -> `XXXX1234`\r\n* `/(PRIVATE\\d{3})/`: `PUBLIC-PRIVATE123-PUBLIC` -> `PUBLIC-XXXXXXXXXX-PUBLIC`"}}