{"action":"closed","issue":{"url":"https://api.github.com/repos/callemall/material-ui/issues/2258","labels_url":"https://api.github.com/repos/callemall/material-ui/issues/2258/labels{/name}","comments_url":"https://api.github.com/repos/callemall/material-ui/issues/2258/comments","events_url":"https://api.github.com/repos/callemall/material-ui/issues/2258/events","html_url":"https://github.com/callemall/material-ui/issues/2258","id":118632036,"number":2258,"title":"Use of `console` makes material-ui break in Nashorn","user":{"login":"Download","id":153391,"avatar_url":"https://avatars.githubusercontent.com/u/153391?v=3","gravatar_id":"","url":"https://api.github.com/users/Download","html_url":"https://github.com/Download","followers_url":"https://api.github.com/users/Download/followers","following_url":"https://api.github.com/users/Download/following{/other_user}","gists_url":"https://api.github.com/users/Download/gists{/gist_id}","starred_url":"https://api.github.com/users/Download/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Download/subscriptions","organizations_url":"https://api.github.com/users/Download/orgs","repos_url":"https://api.github.com/users/Download/repos","events_url":"https://api.github.com/users/Download/events{/privacy}","received_events_url":"https://api.github.com/users/Download/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/callemall/material-ui/labels/Deployment","name":"Deployment","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-24T15:19:30Z","updated_at":"2016-01-12T19:52:56Z","closed_at":"2016-01-12T19:52:56Z","body":"I'm doing server-side rendering in Java using it's built-in Javascript interpreter 'Nashorn'. I noticed when I tried to use this library that it uses the `console` object without a `typeof` check... This makes it break in Nashorn because that has no `console` object available.\r\n\r\nI could (and will) polyfill this on Nashorn, just as I am already doing for the `global` object, which Nashorn also doesn't have, but I still thought you might be interested in knowing about this issue.\r\n\r\nI have developed a small logging library (only 49 lines of code) that works in the browser, on Node JS and on Nashorn that you might be interested in: [Picolog](http://download.github.io/picolog/). It uses the native `console` object on Node JS and the browser (smartly awaiting it's arrival for those browsers that only expose the `console` once the developer tools window is opened), and the global `print` function on Nashorn.\r\n\r\nUsing it would be as simple as:\r\n\r\n```sh\r\nnpm install --save picolog\r\n```\r\n\r\nand then in the code, require the log object:\r\n\r\n```js\r\nvar log = require('picolog')\r\n```\r\n\r\nand finally replace occurances of `console.warn`, `console.error` etc with `log.warn` and `log.error`:\r\n\r\n```js\r\nlog.warn('Using console directly will break your code on some plaforms');\r\nlog.level = log.DEBUG;\r\nlog.debug('Picolog helps your logging become platform independent');\r\n```\r\n\r\n"}}