{"action":"opened","issue":{"url":"https://api.github.com/repos/winstonjs/winston/issues/610","labels_url":"https://api.github.com/repos/winstonjs/winston/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/winstonjs/winston/issues/610/comments","events_url":"https://api.github.com/repos/winstonjs/winston/issues/610/events","html_url":"https://github.com/winstonjs/winston/issues/610","id":69756271,"number":610,"title":"DailyRotateFile mutates meta.message when an Error is passed as meta","user":{"login":"hvrauhal","id":128113,"avatar_url":"https://avatars.githubusercontent.com/u/128113?v=3","gravatar_id":"","url":"https://api.github.com/users/hvrauhal","html_url":"https://github.com/hvrauhal","followers_url":"https://api.github.com/users/hvrauhal/followers","following_url":"https://api.github.com/users/hvrauhal/following{/other_user}","gists_url":"https://api.github.com/users/hvrauhal/gists{/gist_id}","starred_url":"https://api.github.com/users/hvrauhal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvrauhal/subscriptions","organizations_url":"https://api.github.com/users/hvrauhal/orgs","repos_url":"https://api.github.com/users/hvrauhal/repos","events_url":"https://api.github.com/users/hvrauhal/events{/privacy}","received_events_url":"https://api.github.com/users/hvrauhal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-21T06:26:35Z","updated_at":"2015-04-21T06:26:35Z","closed_at":null,"body":"The `Console` transport in the following behaves as expected when an `Error` is passed as meta. `DailyRotateFile` transport sets `error.message` to the string that was supposed to be logged, and does not log the message at all. \r\n\r\nThis is very dangerous behaviour for example when logging exceptions in a web server and passing the error.message to the client. \r\n\r\n```javascript\r\nvar winston = require('winston')\r\n\r\nvar transports = []\r\ntransports.push(new (winston.transports.Console)({level: 'debug'}))\r\n\r\n// The DailyRotateFile MUTATES the message in an exception\r\ntransports.push(new winston.transports.DailyRotateFile({ filename: 'discardme.log', level: 'info' }))\r\n\r\nvar logger = new winston.Logger({transports: transports})\r\nvar error = new Error(\"Bar\")\r\n\r\n// The following statement works as expected with the Console logger, but mutates the error.message with DailyRotateFile:\r\nlogger.error('THIS SHOULD JUST BE LOGGED, NOT ADDED TO ERROR!', error)\r\n\r\nconsole.log(\"Now error.message contains logged text:\", error.message)\r\n\r\nvar today = new Date().toISOString().substring(0, 10)\r\nconsole.log('file contents are:', require('fs').readFileSync('discardme.log' + '.' + today, 'utf-8'))```"}}